Skip to content

Commit 5a52c8a

Browse files
committed
Auto merge of #12333 - MarcusGrass:issue-12223, r=Manishearth
Allow unused_imports, and unused_import_braces on `use` Fixes rust-lang/rust-clippy#12223. Both `unused_import_braces` and `unused_imports` are valid on `use`-items, additional to the two previously allowed. changelog: [`useless_attribute`]: Allow `rustc_lint` `unused_import_braces` and `unused_imports` on `use`-items
2 parents 341ae30 + f197459 commit 5a52c8a

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

clippy_lints/src/attrs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
564564
|| is_word(lint, sym::deprecated)
565565
|| is_word(lint, sym!(unreachable_pub))
566566
|| is_word(lint, sym!(unused))
567+
|| is_word(lint, sym!(unused_import_braces))
567568
|| extract_clippy_lint(lint).map_or(false, |s| {
568569
matches!(
569570
s.as_str(),

tests/ui/useless_attribute.fixed

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ pub mod split {
8080
#[allow(clippy::single_component_path_imports)]
8181
use regex;
8282

83+
mod module {
84+
pub(crate) struct Struct;
85+
}
86+
87+
#[rustfmt::skip]
88+
#[allow(unused_import_braces)]
89+
use module::{Struct};
90+
8391
fn main() {
8492
test_indented_attr();
8593
}

tests/ui/useless_attribute.rs

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ pub mod split {
8080
#[allow(clippy::single_component_path_imports)]
8181
use regex;
8282

83+
mod module {
84+
pub(crate) struct Struct;
85+
}
86+
87+
#[rustfmt::skip]
88+
#[allow(unused_import_braces)]
89+
use module::{Struct};
90+
8391
fn main() {
8492
test_indented_attr();
8593
}

0 commit comments

Comments
 (0)