mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-24 12:03:28 +00:00
28 lines
540 B
Rust
28 lines
540 B
Rust
|
#![allow(unused_must_use)]
|
||
|
#![warn(clippy::write_literal)]
|
||
|
|
||
|
use std::io::Write;
|
||
|
|
||
|
fn main() {
|
||
|
let mut v = Vec::new();
|
||
|
|
||
|
writeln!(&mut v, "{}", "{hello}");
|
||
|
writeln!(&mut v, r"{}", r"{hello}");
|
||
|
writeln!(&mut v, "{}", '\'');
|
||
|
writeln!(&mut v, "{}", '"');
|
||
|
writeln!(&mut v, r"{}", '"'); // don't lint
|
||
|
writeln!(&mut v, r"{}", '\'');
|
||
|
writeln!(
|
||
|
&mut v,
|
||
|
"some {}",
|
||
|
"hello \
|
||
|
world!"
|
||
|
);
|
||
|
writeln!(
|
||
|
&mut v,
|
||
|
"some {}\
|
||
|
{} \\ {}",
|
||
|
"1", "2", "3",
|
||
|
);
|
||
|
}
|