mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 09:27:25 +00:00
34 lines
765 B
Rust
34 lines
765 B
Rust
#![allow(unused_must_use)]
|
|
#![warn(clippy::needless_raw_strings, clippy::write_literal)]
|
|
|
|
use std::io::Write;
|
|
|
|
fn main() {
|
|
let mut v = Vec::new();
|
|
|
|
writeln!(v, "{}", "{hello}");
|
|
writeln!(v, r"{}", r"{hello}");
|
|
writeln!(v, "{}", '\'');
|
|
writeln!(v, "{}", '"');
|
|
writeln!(v, r"{}", '"');
|
|
writeln!(v, r"{}", '\'');
|
|
writeln!(
|
|
v,
|
|
"some {}",
|
|
"hello \
|
|
world!"
|
|
);
|
|
writeln!(
|
|
v,
|
|
"some {}\
|
|
{} \\ {}",
|
|
"1", "2", "3",
|
|
);
|
|
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
|
|
}
|