rust/tests/ui/writeln_empty_string.rs

22 lines
382 B
Rust
Raw Normal View History

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