]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/explicit_write.txt
:arrow_up: rust-analyzer
[rust.git] / src / tools / clippy / src / docs / explicit_write.txt
1 ### What it does
2 Checks for usage of `write!()` / `writeln()!` which can be
3 replaced with `(e)print!()` / `(e)println!()`
4
5 ### Why is this bad?
6 Using `(e)println! is clearer and more concise
7
8 ### Example
9 ```
10 writeln!(&mut std::io::stderr(), "foo: {:?}", bar).unwrap();
11 writeln!(&mut std::io::stdout(), "foo: {:?}", bar).unwrap();
12 ```
13
14 Use instead:
15 ```
16 eprintln!("foo: {:?}", bar);
17 println!("foo: {:?}", bar);
18 ```