about summary refs log tree commit diff
path: root/tests/ui/string_lit_as_bytes.fixed
blob: 7ad272ade5f9c6bb6fbde13e3182a28b47cff0a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// run-rustfix

#![allow(dead_code, unused_variables)]
#![warn(clippy::string_lit_as_bytes)]

fn str_lit_as_bytes() {
    let bs = b"hello there";

    let bs = br###"raw string with 3# plus " ""###;

    // no warning, because these cannot be written as byte string literals:
    let ubs = "☃".as_bytes();
    let ubs = "hello there! this is a very long string".as_bytes();

    let strify = stringify!(foobar).as_bytes();

    let includestr = include_bytes!("entry_unfixable.rs");

    let _ = b"string with newline\t\n";
}

fn main() {}