Skip to content

Commit a3e7b36

Browse files
committed
Rename the lint
1 parent 796779c commit a3e7b36

9 files changed

+18
-18
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3969,6 +3969,7 @@ Released 2018-09-13
39693969
[`unit_hash`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_hash
39703970
[`unit_return_expecting_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_return_expecting_ord
39713971
[`unknown_clippy_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints
3972+
[`unnecessary_box_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_box_return
39723973
[`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
39733974
[`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
39743975
[`unnecessary_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_find_map
@@ -3996,7 +3997,6 @@ Released 2018-09-13
39963997
[`unstable_as_mut_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_mut_slice
39973998
[`unstable_as_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_slice
39983999
[`unused_async`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
3999-
[`unused_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_box
40004000
[`unused_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_collect
40014001
[`unused_io_amount`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
40024002
[`unused_label`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_label

clippy_lints/src/lib.register_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,14 +560,14 @@ store.register_lints(&[
560560
unit_types::UNIT_CMP,
561561
unnamed_address::FN_ADDRESS_COMPARISONS,
562562
unnamed_address::VTABLE_ADDRESS_COMPARISONS,
563+
unnecessary_box_return::UNNECESSARY_BOX_RETURN,
563564
unnecessary_owned_empty_strings::UNNECESSARY_OWNED_EMPTY_STRINGS,
564565
unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS,
565566
unnecessary_sort_by::UNNECESSARY_SORT_BY,
566567
unnecessary_wraps::UNNECESSARY_WRAPS,
567568
unnested_or_patterns::UNNESTED_OR_PATTERNS,
568569
unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
569570
unused_async::UNUSED_ASYNC,
570-
unused_box::UNUSED_BOX,
571571
unused_io_amount::UNUSED_IO_AMOUNT,
572572
unused_rounding::UNUSED_ROUNDING,
573573
unused_self::UNUSED_SELF,

clippy_lints/src/lib.register_nursery.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
3131
LintId::of(trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS),
3232
LintId::of(trait_bounds::TYPE_REPETITION_IN_BOUNDS),
3333
LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR),
34-
LintId::of(unused_box::UNUSED_BOX),
34+
LintId::of(unnecessary_box_return::UNNECESSARY_BOX_RETURN),
3535
LintId::of(unused_rounding::UNUSED_ROUNDING),
3636
LintId::of(use_self::USE_SELF),
3737
])

clippy_lints/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,14 @@ mod unit_hash;
387387
mod unit_return_expecting_ord;
388388
mod unit_types;
389389
mod unnamed_address;
390+
mod unnecessary_box_return;
390391
mod unnecessary_owned_empty_strings;
391392
mod unnecessary_self_imports;
392393
mod unnecessary_sort_by;
393394
mod unnecessary_wraps;
394395
mod unnested_or_patterns;
395396
mod unsafe_removed_from_name;
396397
mod unused_async;
397-
mod unused_box;
398398
mod unused_io_amount;
399399
mod unused_rounding;
400400
mod unused_self;
@@ -931,7 +931,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
931931
store.register_late_pass(|| Box::new(invalid_utf8_in_unchecked::InvalidUtf8InUnchecked));
932932
store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports::default()));
933933
store.register_late_pass(|| Box::new(std_instead_of_core::StdReexports));
934-
store.register_late_pass(|| Box::new(unused_box::UnusedBox));
934+
store.register_late_pass(|| Box::new(unnecessary_box_return::UnnecessaryBoxReturn));
935935
// add lints here, do not remove this comment, it's used in `new_lint`
936936
}
937937

clippy_lints/src/unused_box.rs renamed to clippy_lints/src/unnecessary_box_return.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ declare_clippy_lint! {
3030
/// }
3131
/// ```
3232
#[clippy::version = "1.64.0"]
33-
pub UNUSED_BOX,
33+
pub UNNECESSARY_BOX_RETURN,
3434
nursery,
3535
"Needlessly returning a Box"
3636
}
37-
declare_lint_pass!(UnusedBox => [UNUSED_BOX]);
37+
declare_lint_pass!(UnnecessaryBoxReturn => [UNNECESSARY_BOX_RETURN]);
3838

39-
impl LateLintPass<'_> for UnusedBox {
39+
impl LateLintPass<'_> for UnnecessaryBoxReturn {
4040
fn check_fn(
4141
&mut self,
4242
cx: &LateContext<'_>,
@@ -68,7 +68,7 @@ impl LateLintPass<'_> for UnusedBox {
6868
if implements_trait(cx, boxed_ty, sized_trait, &[]) {
6969
span_lint_and_sugg(
7070
cx,
71-
UNUSED_BOX,
71+
UNNECESSARY_BOX_RETURN,
7272
return_ty_hir.span,
7373
format!("function returns `Box<{0}>` when `{0}` implements `Sized`", boxed_ty).as_str(),
7474
"change the return type to",

tests/ui/unknown_clippy_lints.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// Shouldn't suggest rustc lint name(`dead_code`)
1313
#[warn(clippy::drop_copy)]
1414
// Shouldn't suggest removed/deprecated clippy lint name(`unused_collect`)
15-
#[warn(clippy::unused_box)]
15+
#[warn(clippy::unused_self)]
1616
// Shouldn't suggest renamed clippy lint name(`const_static_lifetime`)
1717
#[warn(clippy::redundant_static_lifetimes)]
1818
fn main() {}

tests/ui/unknown_clippy_lints.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ error: unknown lint: `clippy::unused_colle`
4040
--> $DIR/unknown_clippy_lints.rs:15:8
4141
|
4242
LL | #[warn(clippy::unused_colle)]
43-
| ^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::unused_box`
43+
| ^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::unused_self`
4444

4545
error: unknown lint: `clippy::const_static_lifetim`
4646
--> $DIR/unknown_clippy_lints.rs:17:8

tests/ui/unused_box.rs renamed to tests/ui/unnecessary_box_return.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::unused_box)]
1+
#![warn(clippy::unnecessary_box_return)]
22

33
struct Foo {}
44

@@ -8,7 +8,7 @@ fn boxed_usize() -> Box<usize> {
88
}
99

1010
// lint
11-
fn boxed_string() -> Box<Foo> {
11+
fn boxed_foo() -> Box<Foo> {
1212
Box::new(Foo {})
1313
}
1414

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error: function returns `Box<usize>` when `usize` implements `Sized`
2-
--> $DIR/unused_box.rs:6:21
2+
--> $DIR/unnecessary_box_return.rs:6:21
33
|
44
LL | fn boxed_usize() -> Box<usize> {
55
| ^^^^^^^^^^ help: change the return type to: `usize`
66
|
7-
= note: `-D clippy::unused-box` implied by `-D warnings`
7+
= note: `-D clippy::unnecessary-box-return` implied by `-D warnings`
88

99
error: function returns `Box<Foo>` when `Foo` implements `Sized`
10-
--> $DIR/unused_box.rs:11:22
10+
--> $DIR/unnecessary_box_return.rs:11:19
1111
|
12-
LL | fn boxed_string() -> Box<Foo> {
13-
| ^^^^^^^^ help: change the return type to: `Foo`
12+
LL | fn boxed_foo() -> Box<Foo> {
13+
| ^^^^^^^^ help: change the return type to: `Foo`
1414

1515
error: aborting due to 2 previous errors
1616

0 commit comments

Comments
 (0)