]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/src/docs/manual_string_new.txt
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / src / docs / manual_string_new.txt
CommitLineData
f2b60f7d
FG
1### What it does
2
3Checks for usage of `""` to create a `String`, such as `"".to_string()`, `"".to_owned()`,
4`String::from("")` and others.
5
6### Why is this bad?
7
8Different ways of creating an empty string makes your code less standardized, which can
9be confusing.
10
11### Example
12```
13let a = "".to_string();
14let b: String = "".into();
15```
16Use instead:
17```
18let a = String::new();
19let b = String::new();
20```