From 10201370a1509b806b9e2a83ded6b132466291b8 Mon Sep 17 00:00:00 2001 From: Yoav Lavi Date: Mon, 11 Apr 2022 13:05:42 +0200 Subject: [PATCH] unnecessary_owned_empty_string -> unnecessary_owned_empty_strings --- CHANGELOG.md | 2 +- clippy_lints/src/lib.register_all.rs | 2 +- clippy_lints/src/lib.register_lints.rs | 2 +- clippy_lints/src/lib.register_style.rs | 2 +- clippy_lints/src/lib.rs | 4 ++-- ...ty_string.rs => unnecessary_owned_empty_strings.rs} | 10 +++++----- ...ing.fixed => unnecessary_owned_empty_strings.fixed} | 2 +- ...ty_string.rs => unnecessary_owned_empty_strings.rs} | 2 +- ...g.stderr => unnecessary_owned_empty_strings.stderr} | 6 +++--- 9 files changed, 16 insertions(+), 16 deletions(-) rename clippy_lints/src/{unnecessary_owned_empty_string.rs => unnecessary_owned_empty_strings.rs} (90%) rename tests/ui/{unnecessary_owned_empty_string.fixed => unnecessary_owned_empty_strings.fixed} (87%) rename tests/ui/{unnecessary_owned_empty_string.rs => unnecessary_owned_empty_strings.rs} (88%) rename tests/ui/{unnecessary_owned_empty_string.stderr => unnecessary_owned_empty_strings.stderr} (69%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e48413dc30c..44a36870108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3650,7 +3650,7 @@ Released 2018-09-13 [`unnecessary_lazy_evaluations`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations [`unnecessary_mut_passed`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed [`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation -[`unnecessary_owned_empty_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_owned_empty_string +[`unnecessary_owned_empty_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_owned_empty_strings [`unnecessary_self_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_self_imports [`unnecessary_sort_by`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [`unnecessary_to_owned`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned diff --git a/clippy_lints/src/lib.register_all.rs b/clippy_lints/src/lib.register_all.rs index b601e37a4c8..02ba7835639 100644 --- a/clippy_lints/src/lib.register_all.rs +++ b/clippy_lints/src/lib.register_all.rs @@ -310,7 +310,7 @@ LintId::of(unit_types::UNIT_CMP), LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS), LintId::of(unnamed_address::VTABLE_ADDRESS_COMPARISONS), - LintId::of(unnecessary_owned_empty_string::UNNECESSARY_OWNED_EMPTY_STRING), + LintId::of(unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS), LintId::of(unnecessary_sort_by::UNNECESSARY_SORT_BY), LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME), LintId::of(unused_io_amount::UNUSED_IO_AMOUNT), diff --git a/clippy_lints/src/lib.register_lints.rs b/clippy_lints/src/lib.register_lints.rs index 0a23e60fd2c..704e79885cf 100644 --- a/clippy_lints/src/lib.register_lints.rs +++ b/clippy_lints/src/lib.register_lints.rs @@ -523,7 +523,7 @@ unit_types::UNIT_CMP, unnamed_address::FN_ADDRESS_COMPARISONS, unnamed_address::VTABLE_ADDRESS_COMPARISONS, - unnecessary_owned_empty_string::UNNECESSARY_OWNED_EMPTY_STRING, + unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS, unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS, unnecessary_sort_by::UNNECESSARY_SORT_BY, unnecessary_wraps::UNNECESSARY_WRAPS, diff --git a/clippy_lints/src/lib.register_style.rs b/clippy_lints/src/lib.register_style.rs index b014c11f0f4..f52fe97ed23 100644 --- a/clippy_lints/src/lib.register_style.rs +++ b/clippy_lints/src/lib.register_style.rs @@ -106,7 +106,7 @@ LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS), LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS), LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME), - LintId::of(unnecessary_owned_empty_string::UNNECESSARY_OWNED_EMPTY_STRING), + LintId::of(unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS), LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME), LintId::of(unused_unit::UNUSED_UNIT), LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS), diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 576a6611267..74ade422dc8 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -383,7 +383,7 @@ macro_rules! declare_clippy_lint { mod unit_return_expecting_ord; mod unit_types; mod unnamed_address; -mod unnecessary_owned_empty_string; +mod unnecessary_owned_empty_strings; mod unnecessary_self_imports; mod unnecessary_sort_by; mod unnecessary_wraps; @@ -869,7 +869,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: }); store.register_early_pass(|| Box::new(crate_in_macro_def::CrateInMacroDef)); store.register_early_pass(|| Box::new(empty_structs_with_brackets::EmptyStructsWithBrackets)); - store.register_late_pass(|| Box::new(unnecessary_owned_empty_string::UnnecessaryOwnedEmptyString)); + store.register_late_pass(|| Box::new(unnecessary_owned_empty_strings::UnnecessaryOwnedEmptyStrings)); // add lints here, do not remove this comment, it's used in `new_lint` } diff --git a/clippy_lints/src/unnecessary_owned_empty_string.rs b/clippy_lints/src/unnecessary_owned_empty_strings.rs similarity index 90% rename from clippy_lints/src/unnecessary_owned_empty_string.rs rename to clippy_lints/src/unnecessary_owned_empty_strings.rs index bb42c7816e7..8a4f4c0ad97 100644 --- a/clippy_lints/src/unnecessary_owned_empty_string.rs +++ b/clippy_lints/src/unnecessary_owned_empty_strings.rs @@ -27,13 +27,13 @@ /// vec!["1", "2", "3"].join(""); /// ``` #[clippy::version = "1.62.0"] - pub UNNECESSARY_OWNED_EMPTY_STRING, + pub UNNECESSARY_OWNED_EMPTY_STRINGS, style, "detects cases of references to owned empty strings being passed as an argument to a function expecting `&str`" } -declare_lint_pass!(UnnecessaryOwnedEmptyString => [UNNECESSARY_OWNED_EMPTY_STRING]); +declare_lint_pass!(UnnecessaryOwnedEmptyStrings => [UNNECESSARY_OWNED_EMPTY_STRINGS]); -impl<'tcx> LateLintPass<'tcx> for UnnecessaryOwnedEmptyString { +impl<'tcx> LateLintPass<'tcx> for UnnecessaryOwnedEmptyStrings { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { if_chain! { if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Not, inner_expr) = expr.kind; @@ -46,7 +46,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { if match_def_path(cx, fun_def_id, &paths::STRING_NEW) { span_lint_and_sugg( cx, - UNNECESSARY_OWNED_EMPTY_STRING, + UNNECESSARY_OWNED_EMPTY_STRINGS, expr.span, "usage of `&String::new()` for a function expecting a `&str` argument", "try", @@ -65,7 +65,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { then { span_lint_and_sugg( cx, - UNNECESSARY_OWNED_EMPTY_STRING, + UNNECESSARY_OWNED_EMPTY_STRINGS, expr.span, "usage of `&String::from(\"\")` for a function expecting a `&str` argument", "try", diff --git a/tests/ui/unnecessary_owned_empty_string.fixed b/tests/ui/unnecessary_owned_empty_strings.fixed similarity index 87% rename from tests/ui/unnecessary_owned_empty_string.fixed rename to tests/ui/unnecessary_owned_empty_strings.fixed index cd69e956fd4..f95f91329a2 100644 --- a/tests/ui/unnecessary_owned_empty_string.fixed +++ b/tests/ui/unnecessary_owned_empty_strings.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![warn(clippy::unnecessary_owned_empty_string)] +#![warn(clippy::unnecessary_owned_empty_strings)] fn ref_str_argument(_value: &str) {} diff --git a/tests/ui/unnecessary_owned_empty_string.rs b/tests/ui/unnecessary_owned_empty_strings.rs similarity index 88% rename from tests/ui/unnecessary_owned_empty_string.rs rename to tests/ui/unnecessary_owned_empty_strings.rs index 3fbba156240..0cbdc151ed9 100644 --- a/tests/ui/unnecessary_owned_empty_string.rs +++ b/tests/ui/unnecessary_owned_empty_strings.rs @@ -1,6 +1,6 @@ // run-rustfix -#![warn(clippy::unnecessary_owned_empty_string)] +#![warn(clippy::unnecessary_owned_empty_strings)] fn ref_str_argument(_value: &str) {} diff --git a/tests/ui/unnecessary_owned_empty_string.stderr b/tests/ui/unnecessary_owned_empty_strings.stderr similarity index 69% rename from tests/ui/unnecessary_owned_empty_string.stderr rename to tests/ui/unnecessary_owned_empty_strings.stderr index c32372290d1..46bc4597b33 100644 --- a/tests/ui/unnecessary_owned_empty_string.stderr +++ b/tests/ui/unnecessary_owned_empty_strings.stderr @@ -1,13 +1,13 @@ error: usage of `&String::new()` for a function expecting a `&str` argument - --> $DIR/unnecessary_owned_empty_string.rs:12:22 + --> $DIR/unnecessary_owned_empty_strings.rs:12:22 | LL | ref_str_argument(&String::new()); | ^^^^^^^^^^^^^^ help: try: `""` | - = note: `-D clippy::unnecessary-owned-empty-string` implied by `-D warnings` + = note: `-D clippy::unnecessary-owned-empty-strings` implied by `-D warnings` error: usage of `&String::from("")` for a function expecting a `&str` argument - --> $DIR/unnecessary_owned_empty_string.rs:15:22 + --> $DIR/unnecessary_owned_empty_strings.rs:15:22 | LL | ref_str_argument(&String::from("")); | ^^^^^^^^^^^^^^^^^ help: try: `""` -- 2.44.0