]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/write_literal_2.rs
1 //@no-rustfix: overlapping suggestions
2 #![allow(unused_must_use)]
3 #![warn(clippy::needless_raw_strings, clippy::write_literal)]
8 let mut v
= Vec
::new();
10 writeln
!(v
, "{}", "{hello}");
11 //~^ ERROR: literal with an empty format string
12 //~| NOTE: `-D clippy::write-literal` implied by `-D warnings`
13 writeln
!(v
, r
"{}", r
"{hello}");
14 //~^ ERROR: unnecessary raw string literal
15 //~| NOTE: `-D clippy::needless-raw-strings` implied by `-D warnings`
16 //~| ERROR: literal with an empty format string
17 writeln
!(v
, "{}", '
\''
);
18 //~^ ERROR: literal with an empty format string
19 writeln
!(v
, "{}", '
"');
20 //~^ ERROR: literal with an empty format string
21 writeln!(v, r"{}
", '"'
);
22 //~^ ERROR: literal with an empty format string
23 writeln
!(v
, r
"{}", '
\''
);
24 //~^ ERROR: literal with an empty format string
29 //~^ ERROR: literal with an empty format string
39 //~^ ERROR: literal with an empty format string
41 writeln
!(v
, "{}", "\\");
42 //~^ ERROR: literal with an empty format string
43 writeln
!(v
, r
"{}", "\\");
44 //~^ ERROR: literal with an empty format string
45 writeln
!(v
, r
#"{}"#, "\\");
46 //~^ ERROR: literal with an empty format string
47 writeln
!(v
, "{}", r
"\");
48 //~^ ERROR: literal with an empty format string
49 writeln
!(v
, "{}", "\r");
50 //~^ ERROR: literal with an empty format string
52 writeln
!(v
, r
#"{}{}"#, '#', '"');
53 //~^ ERROR: literal with an empty format string
54 //~| ERROR: literal with an empty format string
56 writeln!(v, r"{}", "\r");