summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/manual_string_new.txt
blob: 4cbc43f8f8439b681a45c17adeb7f937d9fefb0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();
```