summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/manual_string_new.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/manual_string_new.txt')
-rw-r--r--src/tools/clippy/src/docs/manual_string_new.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/manual_string_new.txt b/src/tools/clippy/src/docs/manual_string_new.txt
new file mode 100644
index 000000000..4cbc43f8f
--- /dev/null
+++ b/src/tools/clippy/src/docs/manual_string_new.txt
@@ -0,0 +1,20 @@
+### What it does
+
+Checks for usage of `""` to create a `String`, such as `"".to_string()`, `"".to_owned()`,
+`String::from("")` and others.
+
+### Why is this bad?
+
+Different ways of creating an empty string makes your code less standardized, which can
+be confusing.
+
+### Example
+```
+let a = "".to_string();
+let b: String = "".into();
+```
+Use instead:
+```
+let a = String::new();
+let b = String::new();
+``` \ No newline at end of file