about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/writeln_empty_string.fixed
blob: c3ac15b03751cb62852d7594e9440990b039b8d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// run-rustfix

#![allow(unused_must_use)]
#![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, "");
}