diff --git a/CHANGELOG.md b/CHANGELOG.md index ed2428a11c13..35735a0d0fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3969,7 +3969,7 @@ Released 2018-09-13 [`unit_hash`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_hash [`unit_return_expecting_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_return_expecting_ord [`unknown_clippy_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints -[`unnecessary_box_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_box_return +[`unnecessary_box_returns`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_box_returns [`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map [`unnecessary_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_find_map diff --git a/clippy_lints/src/lib.register_lints.rs b/clippy_lints/src/lib.register_lints.rs index e4059fdc2aee..becfca4cdd7e 100644 --- a/clippy_lints/src/lib.register_lints.rs +++ b/clippy_lints/src/lib.register_lints.rs @@ -560,7 +560,7 @@ store.register_lints(&[ unit_types::UNIT_CMP, unnamed_address::FN_ADDRESS_COMPARISONS, unnamed_address::VTABLE_ADDRESS_COMPARISONS, - unnecessary_box_return::UNNECESSARY_BOX_RETURN, + unnecessary_box_returns::UNNECESSARY_BOX_RETURNS, unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS, unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS, unnecessary_sort_by::UNNECESSARY_SORT_BY, diff --git a/clippy_lints/src/lib.register_nursery.rs b/clippy_lints/src/lib.register_nursery.rs index 9dd58814b8b0..e2ed74a1ebd3 100644 --- a/clippy_lints/src/lib.register_nursery.rs +++ b/clippy_lints/src/lib.register_nursery.rs @@ -31,7 +31,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![ LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS), LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS), LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR), - LintId::of(unnecessary_box_return::UNNECESSARY_BOX_RETURN), + LintId::of(unnecessary_box_returns::UNNECESSARY_BOX_RETURNS), LintId::of(unused_rounding::UNUSED_ROUNDING), LintId::of(use_self::USE_SELF), ]) diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 1bd8d7028fab..bc1c6c14bb4a 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -387,7 +387,7 @@ mod unit_hash; mod unit_return_expecting_ord; mod unit_types; mod unnamed_address; -mod unnecessary_box_return; +mod unnecessary_box_returns; mod unnecessary_owned_empty_strings; mod unnecessary_self_imports; mod unnecessary_sort_by; @@ -931,7 +931,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(|| Box::new(invalid_utf8_in_unchecked::InvalidUtf8InUnchecked)); store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports::default())); store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports)); - store.register_late_pass(|| Box::new(unnecessary_box_return::UnnecessaryBoxReturn)); + store.register_late_pass(|| Box::new(unnecessary_box_returns::UnnecessaryBoxReturns)); // add lints here, do not remove this comment, it's used in `new_lint` } diff --git a/clippy_lints/src/unnecessary_box_return.rs b/clippy_lints/src/unnecessary_box_returns.rs similarity index 92% rename from clippy_lints/src/unnecessary_box_return.rs rename to clippy_lints/src/unnecessary_box_returns.rs index e9e66dbb3117..bb190c660c64 100644 --- a/clippy_lints/src/unnecessary_box_return.rs +++ b/clippy_lints/src/unnecessary_box_returns.rs @@ -30,13 +30,13 @@ declare_clippy_lint! { /// } /// ``` #[clippy::version = "1.64.0"] - pub UNNECESSARY_BOX_RETURN, + pub UNNECESSARY_BOX_RETURNS, nursery, "Needlessly returning a Box" } -declare_lint_pass!(UnnecessaryBoxReturn => [UNNECESSARY_BOX_RETURN]); +declare_lint_pass!(UnnecessaryBoxReturns => [UNNECESSARY_BOX_RETURNS]); -impl LateLintPass<'_> for UnnecessaryBoxReturn { +impl LateLintPass<'_> for UnnecessaryBoxReturns { fn check_fn( &mut self, cx: &LateContext<'_>, @@ -68,7 +68,7 @@ impl LateLintPass<'_> for UnnecessaryBoxReturn { if implements_trait(cx, boxed_ty, sized_trait, &[]) { span_lint_and_sugg( cx, - UNNECESSARY_BOX_RETURN, + UNNECESSARY_BOX_RETURNS, return_ty_hir.span, format!("function returns `Box<{0}>` when `{0}` implements `Sized`", boxed_ty).as_str(), "change the return type to", diff --git a/tests/ui/unnecessary_box_return.rs b/tests/ui/unnecessary_box_returns.rs similarity index 92% rename from tests/ui/unnecessary_box_return.rs rename to tests/ui/unnecessary_box_returns.rs index 701aa094a44d..49e24878c82d 100644 --- a/tests/ui/unnecessary_box_return.rs +++ b/tests/ui/unnecessary_box_returns.rs @@ -1,4 +1,4 @@ -#![warn(clippy::unnecessary_box_return)] +#![warn(clippy::unnecessary_box_returns)] struct Foo {} diff --git a/tests/ui/unnecessary_box_return.stderr b/tests/ui/unnecessary_box_returns.stderr similarity index 72% rename from tests/ui/unnecessary_box_return.stderr rename to tests/ui/unnecessary_box_returns.stderr index 044637217a9d..cf0fe2b13fcb 100644 --- a/tests/ui/unnecessary_box_return.stderr +++ b/tests/ui/unnecessary_box_returns.stderr @@ -1,13 +1,13 @@ error: function returns `Box` when `usize` implements `Sized` - --> $DIR/unnecessary_box_return.rs:6:21 + --> $DIR/unnecessary_box_returns.rs:6:21 | LL | fn boxed_usize() -> Box { | ^^^^^^^^^^ help: change the return type to: `usize` | - = note: `-D clippy::unnecessary-box-return` implied by `-D warnings` + = note: `-D clippy::unnecessary-box-returns` implied by `-D warnings` error: function returns `Box` when `Foo` implements `Sized` - --> $DIR/unnecessary_box_return.rs:11:19 + --> $DIR/unnecessary_box_returns.rs:11:19 | LL | fn boxed_foo() -> Box { | ^^^^^^^^ help: change the return type to: `Foo`