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()`
This commit is contained in:
bors
2022-08-19 11:19:06 +00:00
32 changed files with 371 additions and 38 deletions

View File

@@ -273,6 +273,7 @@ mod main_recursion;
mod manual_assert;
mod manual_async_fn;
mod manual_bits;
mod manual_empty_string_creations;
mod manual_instant_elapsed;
mod manual_non_exhaustive;
mod manual_ok_or;
@@ -933,6 +934,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports::default()));
store.register_late_pass(|| Box::new(manual_instant_elapsed::ManualInstantElapsed));
store.register_late_pass(|| Box::new(partialeq_to_none::PartialeqToNone));
store.register_late_pass(|| Box::new(manual_empty_string_creations::ManualEmptyStringCreations));
// add lints here, do not remove this comment, it's used in `new_lint`
}