summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/writeln_empty_string.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/writeln_empty_string.fixed')
-rw-r--r--src/tools/clippy/tests/ui/writeln_empty_string.fixed20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/writeln_empty_string.fixed b/src/tools/clippy/tests/ui/writeln_empty_string.fixed
new file mode 100644
index 000000000..e7d94acd1
--- /dev/null
+++ b/src/tools/clippy/tests/ui/writeln_empty_string.fixed
@@ -0,0 +1,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!(v);
+
+ let mut suggestion = Vec::new();
+ writeln!(suggestion);
+
+ // These should be fine
+ writeln!(v);
+ writeln!(v, " ");
+ write!(v, "");
+}