2023-07-27 06:40:22 -05:00
|
|
|
//@no-rustfix: overlapping suggestions
|
2021-03-01 15:31:04 -06:00
|
|
|
#![allow(unused_must_use)]
|
2023-06-15 14:15:10 -05:00
|
|
|
#![warn(clippy::needless_raw_strings, clippy::write_literal)]
|
2021-03-01 15:31:04 -06:00
|
|
|
|
|
|
|
use std::io::Write;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut v = Vec::new();
|
|
|
|
|
2022-01-11 13:31:35 -06:00
|
|
|
writeln!(v, "{}", "{hello}");
|
|
|
|
writeln!(v, r"{}", r"{hello}");
|
|
|
|
writeln!(v, "{}", '\'');
|
|
|
|
writeln!(v, "{}", '"');
|
2022-08-30 07:20:49 -05:00
|
|
|
writeln!(v, r"{}", '"');
|
2022-01-11 13:31:35 -06:00
|
|
|
writeln!(v, r"{}", '\'');
|
2021-03-01 15:31:04 -06:00
|
|
|
writeln!(
|
2022-01-11 13:31:35 -06:00
|
|
|
v,
|
2021-03-01 15:31:04 -06:00
|
|
|
"some {}",
|
|
|
|
"hello \
|
|
|
|
world!"
|
|
|
|
);
|
|
|
|
writeln!(
|
2022-01-11 13:31:35 -06:00
|
|
|
v,
|
2021-03-01 15:31:04 -06:00
|
|
|
"some {}\
|
|
|
|
{} \\ {}",
|
|
|
|
"1", "2", "3",
|
|
|
|
);
|
2022-08-30 07:20:49 -05:00
|
|
|
writeln!(v, "{}", "\\");
|
|
|
|
writeln!(v, r"{}", "\\");
|
|
|
|
writeln!(v, r#"{}"#, "\\");
|
|
|
|
writeln!(v, "{}", r"\");
|
|
|
|
writeln!(v, "{}", "\r");
|
|
|
|
writeln!(v, r#"{}{}"#, '#', '"'); // hard mode
|
|
|
|
writeln!(v, r"{}", "\r"); // should not lint
|
2021-03-01 15:31:04 -06:00
|
|
|
}
|