about summary refs log tree commit diff
path: root/src/docs/explicit_write.txt
blob: eafed5d39e5c63e48783ae846b87de9c1c901ffe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### What it does
Checks for usage of `write!()` / `writeln()!` which can be
replaced with `(e)print!()` / `(e)println!()`

### Why is this bad?
Using `(e)println! is clearer and more concise

### Example
```
writeln!(&mut std::io::stderr(), "foo: {:?}", bar).unwrap();
writeln!(&mut std::io::stdout(), "foo: {:?}", bar).unwrap();
```

Use instead:
```
eprintln!("foo: {:?}", bar);
println!("foo: {:?}", bar);
```