Skip to content

Commit d62294d

Browse files
botahamecdswij
authored andcommitted
Rename the lint
1 parent 4295c95 commit d62294d

9 files changed

+17
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4619,6 +4619,7 @@ Released 2018-09-13
46194619
[`unit_hash`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_hash
46204620
[`unit_return_expecting_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_return_expecting_ord
46214621
[`unknown_clippy_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints
4622+
[`unnecessary_box_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_box_return
46224623
[`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
46234624
[`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
46244625
[`unnecessary_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_find_map
@@ -4648,7 +4649,6 @@ Released 2018-09-13
46484649
[`unstable_as_mut_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_mut_slice
46494650
[`unstable_as_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_slice
46504651
[`unused_async`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_async
4651-
[`unused_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_box
46524652
[`unused_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_collect
46534653
[`unused_format_specs`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_format_specs
46544654
[`unused_io_amount`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount

clippy_lints/src/lib.register_lints.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ mod uninit_vec;
288288
mod unit_return_expecting_ord;
289289
mod unit_types;
290290
mod unnamed_address;
291+
mod unnecessary_box_return;
291292
mod unnecessary_owned_empty_strings;
292293
mod unnecessary_self_imports;
293294
mod unnecessary_wraps;
294295
mod unnested_or_patterns;
295296
mod unsafe_removed_from_name;
296297
mod unused_async;
297-
mod unused_box;
298298
mod unused_io_amount;
299299
mod unused_peekable;
300300
mod unused_rounding;

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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 5 additions & 5 deletions
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)