Skip to content

Commit dfc5a52

Browse files
Rename anon_trait_imports -> unused_trait_names
1 parent e11fa3d commit dfc5a52

8 files changed

+33
-33
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5295,7 +5295,6 @@ Released 2018-09-13
52955295
[`almost_complete_letter_range`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_letter_range
52965296
[`almost_complete_range`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_complete_range
52975297
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
5298-
[`anon_trait_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#anon_trait_imports
52995298
[`approx_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
53005299
[`arc_with_non_send_sync`]: https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
53015300
[`arithmetic_side_effects`]: https://rust-lang.github.io/rust-clippy/master/index.html#arithmetic_side_effects
@@ -6063,6 +6062,7 @@ Released 2018-09-13
60636062
[`unused_result_ok`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_result_ok
60646063
[`unused_rounding`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_rounding
60656064
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
6065+
[`unused_trait_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_trait_names
60666066
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
60676067
[`unusual_byte_groupings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unusual_byte_groupings
60686068
[`unwrap_in_result`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_in_result

clippy_lints/src/attrs/useless_attribute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(super) fn check(cx: &LateContext<'_>, item: &Item<'_>, attrs: &[Attribute])
5151
| "module_name_repetitions"
5252
| "single_component_path_imports"
5353
| "disallowed_types"
54-
| "anon_trait_imports"
54+
| "unused_trait_names"
5555
)
5656
}) {
5757
return;

clippy_lints/src/declared_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ pub static LINTS: &[&crate::LintInfo] = &[
3333
crate::utils::internal_lints::unsorted_clippy_utils_paths::UNSORTED_CLIPPY_UTILS_PATHS_INFO,
3434
crate::absolute_paths::ABSOLUTE_PATHS_INFO,
3535
crate::almost_complete_range::ALMOST_COMPLETE_RANGE_INFO,
36-
crate::anon_trait_imports::ANON_TRAIT_IMPORTS_INFO,
3736
crate::approx_const::APPROX_CONSTANT_INFO,
3837
crate::arc_with_non_send_sync::ARC_WITH_NON_SEND_SYNC_INFO,
3938
crate::as_conversions::AS_CONVERSIONS_INFO,
@@ -748,6 +747,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
748747
crate::unused_result_ok::UNUSED_RESULT_OK_INFO,
749748
crate::unused_rounding::UNUSED_ROUNDING_INFO,
750749
crate::unused_self::UNUSED_SELF_INFO,
750+
crate::unused_trait_names::UNUSED_TRAIT_NAMES_INFO,
751751
crate::unused_unit::UNUSED_UNIT_INFO,
752752
crate::unwrap::PANICKING_UNWRAP_INFO,
753753
crate::unwrap::UNNECESSARY_UNWRAP_INFO,

clippy_lints/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub mod deprecated_lints;
7272
// begin lints modules, do not remove this comment, it’s used in `update_lints`
7373
mod absolute_paths;
7474
mod almost_complete_range;
75-
mod anon_trait_imports;
7675
mod approx_const;
7776
mod arc_with_non_send_sync;
7877
mod as_conversions;
@@ -377,6 +376,7 @@ mod unused_peekable;
377376
mod unused_result_ok;
378377
mod unused_rounding;
379378
mod unused_self;
379+
mod unused_trait_names;
380380
mod unused_unit;
381381
mod unwrap;
382382
mod unwrap_in_result;
@@ -943,6 +943,6 @@ pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
943943
store.register_late_pass(move |_| Box::new(manual_div_ceil::ManualDivCeil::new(conf)));
944944
store.register_late_pass(|_| Box::new(manual_is_power_of_two::ManualIsPowerOfTwo));
945945
store.register_late_pass(|_| Box::new(non_zero_suggestions::NonZeroSuggestions));
946-
store.register_late_pass(move |_| Box::new(anon_trait_imports::AnonTraitImports::new(conf)));
946+
store.register_late_pass(move |_| Box::new(unused_trait_names::UnusedTraitNames::new(conf)));
947947
// add lints here, do not remove this comment, it's used in `new_lint`
948948
}

clippy_lints/src/anon_trait_imports.rs renamed to clippy_lints/src/unused_trait_names.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ declare_clippy_lint! {
4141
/// }
4242
/// ```
4343
#[clippy::version = "1.82.0"]
44-
pub ANON_TRAIT_IMPORTS,
44+
pub UNUSED_TRAIT_NAMES,
4545
restriction,
4646
"use items that import a trait but only use it anonymously"
4747
}
4848

49-
pub struct AnonTraitImports {
49+
pub struct UnusedTraitNames {
5050
msrv: Msrv,
5151
}
5252

53-
impl AnonTraitImports {
53+
impl UnusedTraitNames {
5454
pub fn new(conf: &'static Conf) -> Self {
5555
Self {
5656
msrv: conf.msrv.clone(),
5757
}
5858
}
5959
}
6060

61-
impl_lint_pass!(AnonTraitImports => [ANON_TRAIT_IMPORTS]);
61+
impl_lint_pass!(UnusedTraitNames => [UNUSED_TRAIT_NAMES]);
6262

63-
impl<'tcx> LateLintPass<'tcx> for AnonTraitImports {
63+
impl<'tcx> LateLintPass<'tcx> for UnusedTraitNames {
6464
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
6565
if self.msrv.meets(msrvs::UNDERSCORE_IMPORTS)
6666
&& !in_external_macro(cx.sess(), item.span)
@@ -80,7 +80,7 @@ impl<'tcx> LateLintPass<'tcx> for AnonTraitImports {
8080
let complete_span = last_segment.ident.span.to(item.ident.span);
8181
span_lint_and_sugg(
8282
cx,
83-
ANON_TRAIT_IMPORTS,
83+
UNUSED_TRAIT_NAMES,
8484
complete_span,
8585
"importing trait that is only used anonymously",
8686
"use",

tests/ui/anon_trait_imports.fixed renamed to tests/ui/unused_trait_names.fixed

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@aux-build:proc_macros.rs
22

33
#![allow(unused)]
4-
#![warn(clippy::anon_trait_imports)]
4+
#![warn(clippy::unused_trait_names)]
55
#![feature(decl_macro)]
66

77
extern crate proc_macros;
@@ -239,20 +239,20 @@ proc_macros::with_span!(
239239
}
240240
);
241241

242-
// This should warn the import is unused but should not trigger anon_trait_imports
242+
// This should warn the import is unused but should not trigger unused_trait_names
243243
#[warn(unused)]
244244
mod unused_import {
245245

246246
}
247247

248-
#[allow(clippy::anon_trait_imports)]
248+
#[allow(clippy::unused_trait_names)]
249249
fn allow_lint_fn() {
250250
use std::any::Any;
251251

252252
"foo".type_id();
253253
}
254254

255-
#[allow(clippy::anon_trait_imports)]
255+
#[allow(clippy::unused_trait_names)]
256256
mod allow_lint_mod {
257257
use std::any::Any;
258258

@@ -262,7 +262,7 @@ mod allow_lint_mod {
262262
}
263263

264264
mod allow_lint_import {
265-
#[allow(clippy::anon_trait_imports)]
265+
#[allow(clippy::unused_trait_names)]
266266
use std::any::Any;
267267

268268
fn foo() {

tests/ui/anon_trait_imports.rs renamed to tests/ui/unused_trait_names.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@aux-build:proc_macros.rs
22

33
#![allow(unused)]
4-
#![warn(clippy::anon_trait_imports)]
4+
#![warn(clippy::unused_trait_names)]
55
#![feature(decl_macro)]
66

77
extern crate proc_macros;
@@ -239,20 +239,20 @@ proc_macros::with_span!(
239239
}
240240
);
241241

242-
// This should warn the import is unused but should not trigger anon_trait_imports
242+
// This should warn the import is unused but should not trigger unused_trait_names
243243
#[warn(unused)]
244244
mod unused_import {
245245
use std::any::Any;
246246
}
247247

248-
#[allow(clippy::anon_trait_imports)]
248+
#[allow(clippy::unused_trait_names)]
249249
fn allow_lint_fn() {
250250
use std::any::Any;
251251

252252
"foo".type_id();
253253
}
254254

255-
#[allow(clippy::anon_trait_imports)]
255+
#[allow(clippy::unused_trait_names)]
256256
mod allow_lint_mod {
257257
use std::any::Any;
258258

@@ -262,7 +262,7 @@ mod allow_lint_mod {
262262
}
263263

264264
mod allow_lint_import {
265-
#[allow(clippy::anon_trait_imports)]
265+
#[allow(clippy::unused_trait_names)]
266266
use std::any::Any;
267267

268268
fn foo() {

tests/ui/anon_trait_imports.stderr renamed to tests/ui/unused_trait_names.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unused import: `std::any::Any`
2-
--> tests/ui/anon_trait_imports.rs:245:9
2+
--> tests/ui/unused_trait_names.rs:245:9
33
|
44
LL | use std::any::Any;
55
| ^^^^^^^^^^^^^
@@ -8,58 +8,58 @@ LL | use std::any::Any;
88
= help: to override `-D warnings` add `#[allow(unused_imports)]`
99

1010
error: importing trait that is only used anonymously
11-
--> tests/ui/anon_trait_imports.rs:12:19
11+
--> tests/ui/unused_trait_names.rs:12:19
1212
|
1313
LL | use std::any::Any;
1414
| ^^^ help: use: `Any as _`
1515
|
16-
= note: `-D clippy::anon-trait-imports` implied by `-D warnings`
17-
= help: to override `-D warnings` add `#[allow(clippy::anon_trait_imports)]`
16+
= note: `-D clippy::unused-trait-names` implied by `-D warnings`
17+
= help: to override `-D warnings` add `#[allow(clippy::unused_trait_names)]`
1818

1919
error: importing trait that is only used anonymously
20-
--> tests/ui/anon_trait_imports.rs:31:26
20+
--> tests/ui/unused_trait_names.rs:31:26
2121
|
2222
LL | use std::any::{self, Any, TypeId};
2323
| ^^^ help: use: `Any as _`
2424

2525
error: importing trait that is only used anonymously
26-
--> tests/ui/anon_trait_imports.rs:43:19
26+
--> tests/ui/unused_trait_names.rs:43:19
2727
|
2828
LL | use std::any::Any as MyAny;
2929
| ^^^^^^^^^^^^ help: use: `Any as _`
3030

3131
error: importing trait that is only used anonymously
32-
--> tests/ui/anon_trait_imports.rs:49:20
32+
--> tests/ui/unused_trait_names.rs:49:20
3333
|
3434
LL | use std::any::{Any as MyAny, TypeId as MyTypeId};
3535
| ^^^^^^^^^^^^ help: use: `Any as _`
3636

3737
error: importing trait that is only used anonymously
38-
--> tests/ui/anon_trait_imports.rs:72:23
38+
--> tests/ui/unused_trait_names.rs:72:23
3939
|
4040
LL | use std::any::Any;
4141
| ^^^ help: use: `Any as _`
4242

4343
error: importing trait that is only used anonymously
44-
--> tests/ui/anon_trait_imports.rs:113:19
44+
--> tests/ui/unused_trait_names.rs:113:19
4545
|
4646
LL | use std::any::Any;
4747
| ^^^ help: use: `Any as _`
4848

4949
error: importing trait that is only used anonymously
50-
--> tests/ui/anon_trait_imports.rs:132:19
50+
--> tests/ui/unused_trait_names.rs:132:19
5151
|
5252
LL | use std::any::Any;
5353
| ^^^ help: use: `Any as _`
5454

5555
error: importing trait that is only used anonymously
56-
--> tests/ui/anon_trait_imports.rs:191:34
56+
--> tests/ui/unused_trait_names.rs:191:34
5757
|
5858
LL | use simple_trait::{MyStruct, MyTrait};
5959
| ^^^^^^^ help: use: `MyTrait as _`
6060

6161
error: importing trait that is only used anonymously
62-
--> tests/ui/anon_trait_imports.rs:198:27
62+
--> tests/ui/unused_trait_names.rs:198:27
6363
|
6464
LL | use std::any::Any;
6565
| ^^^ help: use: `Any as _`

0 commit comments

Comments
 (0)