about summary refs log tree commit diff
path: root/clippy_dev
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-19 11:19:06 +0000
committerbors <bors@rust-lang.org>2022-08-19 11:19:06 +0000
commit868dba9f65a40ffd406baba9ca301b4dc33ff641 (patch)
tree5ad7dfee4e1721328930d7db626f57dd81f0fe9d /clippy_dev
parenteeaaba3713d6590459f4516a783fbf76b3e59c2f (diff)
parent1bf88414790bacf5773bd7f19f0c58e183d0ca7c (diff)
downloadrust-868dba9f65a40ffd406baba9ca301b4dc33ff641.tar.gz
rust-868dba9f65a40ffd406baba9ca301b4dc33ff641.zip
Auto merge of #9295 - Guilherme-Vasconcelos:manual-empty-string-creation, r=dswij
Add `manual_empty_string_creations` lint

Closes #2972

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `cargo dev update_lints`
- [x] Added lint documentation
- [x] Run `cargo dev fmt`

changelog: [`manual_empty_string_creations`]: Add lint for empty String not being created with `String::new()`
Diffstat (limited to 'clippy_dev')
-rw-r--r--clippy_dev/src/new_lint.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_dev/src/new_lint.rs b/clippy_dev/src/new_lint.rs
index 10a8f31f457..be05e67d724 100644
--- a/clippy_dev/src/new_lint.rs
+++ b/clippy_dev/src/new_lint.rs
@@ -155,7 +155,7 @@ fn to_camel_case(name: &str) -> String {
     name.split('_')
         .map(|s| {
             if s.is_empty() {
-                String::from("")
+                String::new()
             } else {
                 [&s[0..1].to_uppercase(), &s[1..]].concat()
             }