mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 00:47:16 +00:00
29 lines
759 B
Rust
29 lines
759 B
Rust
#![feature(tool_lints)]
|
|
|
|
#![allow(clippy::write_literal)]
|
|
#![warn(clippy::write_with_newline)]
|
|
|
|
use std::io::Write;
|
|
|
|
fn main() {
|
|
let mut v = Vec::new();
|
|
|
|
// These should fail
|
|
write!(&mut v, "Hello\n");
|
|
write!(&mut v, "Hello {}\n", "world");
|
|
write!(&mut v, "Hello {} {}\n", "world", "#2");
|
|
write!(&mut v, "{}\n", 1265);
|
|
|
|
// These should be fine
|
|
write!(&mut v, "");
|
|
write!(&mut v, "Hello");
|
|
writeln!(&mut v, "Hello");
|
|
writeln!(&mut v, "Hello\n");
|
|
writeln!(&mut v, "Hello {}\n", "world");
|
|
write!(&mut v, "Issue\n{}", 1265);
|
|
write!(&mut v, "{}", 1265);
|
|
write!(&mut v, "\n{}", 1275);
|
|
write!(&mut v, "\n\n");
|
|
write!(&mut v, "like eof\n\n");
|
|
write!(&mut v, "Hello {} {}\n\n", "world", "#2");
|
|
}
|