rust-clippy/tests/ui/writeln_empty_string.rs

21 lines
347 B
Rust
Raw Normal View History

// run-rustfix
#![allow(unused_must_use)]
2018-07-28 15:34:52 +00:00
#![warn(clippy::writeln_empty_string)]
use std::io::Write;
fn main() {
let mut v = Vec::new();
// These should fail
writeln!(v, "");
let mut suggestion = Vec::new();
writeln!(suggestion, "");
// These should be fine
writeln!(v);
writeln!(v, " ");
write!(v, "");
}