5 #[allow(string_add_assign)]
6 fn add_only() { // ignores assignment distinction
7 let mut x = "".to_owned();
13 let y = "".to_owned();
19 #[warn(string_add_assign)]
20 fn add_assign_only() {
21 let mut x = "".to_owned();
27 let y = "".to_owned();
33 #[warn(string_add, string_add_assign)]
35 let mut x = "".to_owned();
41 let y = "".to_owned();
47 #[allow(dead_code, unused_variables)]
48 #[warn(string_lit_as_bytes)]
49 fn str_lit_as_bytes() {
50 let bs = "hello there".as_bytes();
52 // no warning, because this cannot be written as a byte string literal:
53 let ubs = "☃".as_bytes();
55 let strify = stringify!(foobar).as_bytes();
63 // the add is only caught for `String`