]> git.lizzy.rs Git - rust.git/blob - src/docs/write_with_newline.txt
Auto merge of #9425 - kraktus:patch-1, r=xFrednet
[rust.git] / src / docs / write_with_newline.txt
1 ### What it does
2 This lint warns when you use `write!()` with a format
3 string that
4 ends in a newline.
5
6 ### Why is this bad?
7 You should use `writeln!()` instead, which appends the
8 newline.
9
10 ### Example
11 ```
12 write!(buf, "Hello {}!\n", name);
13 ```
14
15 Use instead:
16 ```
17 writeln!(buf, "Hello {}!", name);
18 ```