mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 11:03:16 +00:00
a7fa2a6fa8
Don't lint on a mixture of raw and regular strings Fix spans in format strings
124 lines
3.2 KiB
Text
124 lines
3.2 KiB
Text
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:25:24
|
|
|
|
|
LL | print!("Hello {}", "world");
|
|
| ^^^^^^^
|
|
|
|
|
= note: `-D clippy::print-literal` implied by `-D warnings`
|
|
help: try this
|
|
|
|
|
LL | print!("Hello world");
|
|
| ^^^^^--
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:26:36
|
|
|
|
|
LL | println!("Hello {} {}", world, "world");
|
|
| ^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("Hello {} world", world);
|
|
| ^^^^^ --
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:27:26
|
|
|
|
|
LL | println!("Hello {}", "world");
|
|
| ^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("Hello world");
|
|
| ^^^^^--
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:32:25
|
|
|
|
|
LL | println!("{0} {1}", "hello", "world");
|
|
| ^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("hello {1}", "world");
|
|
| ^^^^^ --
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:32:34
|
|
|
|
|
LL | println!("{0} {1}", "hello", "world");
|
|
| ^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("{0} world", "hello");
|
|
| ^^^^^ --
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:33:25
|
|
|
|
|
LL | println!("{1} {0}", "hello", "world");
|
|
| ^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("{1} hello", "world");
|
|
| ^^^^^--
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:33:34
|
|
|
|
|
LL | println!("{1} {0}", "hello", "world");
|
|
| ^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("world {0}", "hello");
|
|
| ^^^^^ --
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:36:29
|
|
|
|
|
LL | println!("{foo} {bar}", foo = "hello", bar = "world");
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("hello {bar}", bar = "world");
|
|
| ^^^^^ --
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:36:44
|
|
|
|
|
LL | println!("{foo} {bar}", foo = "hello", bar = "world");
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("{foo} world", foo = "hello");
|
|
| ^^^^^ --
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:37:29
|
|
|
|
|
LL | println!("{bar} {foo}", foo = "hello", bar = "world");
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("{bar} hello", bar = "world");
|
|
| ^^^^^--
|
|
|
|
error: literal with an empty format string
|
|
--> $DIR/print_literal.rs:37:44
|
|
|
|
|
LL | println!("{bar} {foo}", foo = "hello", bar = "world");
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
help: try this
|
|
|
|
|
LL | println!("world {foo}", foo = "hello");
|
|
| ^^^^^ --
|
|
|
|
error: aborting due to 11 previous errors
|
|
|