rust/tests/ui/write_literal_2.rs
Centri3 8cb6c86996 change category and refactor
Update raw_strings.rs

Revert "new lints for visibility"

This reverts commit 0e5a537d209727169769dc19cf86aef27122c092.

new lints for visibility
2023-06-27 05:16:40 -05:00

35 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
}