summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/write_with_newline.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/write_with_newline.txt')
-rw-r--r--src/tools/clippy/src/docs/write_with_newline.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/write_with_newline.txt b/src/tools/clippy/src/docs/write_with_newline.txt
new file mode 100644
index 000000000..22845fd65
--- /dev/null
+++ b/src/tools/clippy/src/docs/write_with_newline.txt
@@ -0,0 +1,18 @@
+### What it does
+This lint warns when you use `write!()` with a format
+string that
+ends in a newline.
+
+### Why is this bad?
+You should use `writeln!()` instead, which appends the
+newline.
+
+### Example
+```
+write!(buf, "Hello {}!\n", name);
+```
+
+Use instead:
+```
+writeln!(buf, "Hello {}!", name);
+``` \ No newline at end of file