]> git.lizzy.rs Git - rust.git/blob - tests/ui/string_lit_as_bytes.rs
iterate List by value
[rust.git] / tests / ui / string_lit_as_bytes.rs
1 // run-rustfix
2
3 #![allow(dead_code, unused_variables)]
4 #![warn(clippy::string_lit_as_bytes)]
5
6 fn str_lit_as_bytes() {
7     let bs = "hello there".as_bytes();
8
9     let bs = r###"raw string with 3# plus " ""###.as_bytes();
10
11     // no warning, because these cannot be written as byte string literals:
12     let ubs = "☃".as_bytes();
13     let ubs = "hello there! this is a very long string".as_bytes();
14
15     let strify = stringify!(foobar).as_bytes();
16
17     let includestr = include_str!("entry_unfixable.rs").as_bytes();
18
19     let _ = "string with newline\t\n".as_bytes();
20 }
21
22 fn main() {}