]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | ### What it does |
2 | ||
3 | Checks 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 | ||
8 | Different ways of creating an empty string makes your code less standardized, which can | |
9 | be confusing. | |
10 | ||
11 | ### Example | |
12 | ``` | |
13 | let a = "".to_string(); | |
14 | let b: String = "".into(); | |
15 | ``` | |
16 | Use instead: | |
17 | ``` | |
18 | let a = String::new(); | |
19 | let b = String::new(); | |
20 | ``` |