diff options
Diffstat (limited to 'src/docs/useless_format.txt')
| -rw-r--r-- | src/docs/useless_format.txt | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/docs/useless_format.txt b/src/docs/useless_format.txt deleted file mode 100644 index eb4819da1e9..00000000000 --- a/src/docs/useless_format.txt +++ /dev/null @@ -1,22 +0,0 @@ -### What it does -Checks for the use of `format!("string literal with no -argument")` and `format!("{}", foo)` where `foo` is a string. - -### Why is this bad? -There is no point of doing that. `format!("foo")` can -be replaced by `"foo".to_owned()` if you really need a `String`. The even -worse `&format!("foo")` is often encountered in the wild. `format!("{}", -foo)` can be replaced by `foo.clone()` if `foo: String` or `foo.to_owned()` -if `foo: &str`. - -### Examples -``` -let foo = "foo"; -format!("{}", foo); -``` - -Use instead: -``` -let foo = "foo"; -foo.to_owned(); -``` \ No newline at end of file |
