about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-22 22:47:03 +0000
committerbors <bors@rust-lang.org>2024-02-22 22:47:03 +0000
commit5a52c8aee97a7f57f53222000b58ffd11bfac1f7 (patch)
tree54b40472d9ffee4de9f416b63e2bf638fed76f32
parent341ae30a854a00c3876ac8b53b842eae31f0613e (diff)
parentf1974593c93f80707123e9f12a4d8a097bb367a5 (diff)
Auto merge of #12333 - MarcusGrass:issue-12223, r=Manishearth
Allow unused_imports, and unused_import_braces on `use`

Fixes https://github.com/rust-lang/rust-clippy/issues/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
-rw-r--r--clippy_lints/src/attrs.rs1
-rw-r--r--tests/ui/useless_attribute.fixed8
-rw-r--r--tests/ui/useless_attribute.rs8
3 files changed, 17 insertions, 0 deletions
diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs
index 340111edcf1..f2937d51340 100644
--- a/clippy_lints/src/attrs.rs
+++ b/clippy_lints/src/attrs.rs
@@ -564,6 +564,7 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
                                             || is_word(lint, sym::deprecated)
                                             || is_word(lint, sym!(unreachable_pub))
                                             || is_word(lint, sym!(unused))
+                                            || is_word(lint, sym!(unused_import_braces))
                                             || extract_clippy_lint(lint).map_or(false, |s| {
                                                 matches!(
                                                     s.as_str(),
diff --git a/tests/ui/useless_attribute.fixed b/tests/ui/useless_attribute.fixed
index c7d611f36cf..d1cdf73d559 100644
--- a/tests/ui/useless_attribute.fixed
+++ b/tests/ui/useless_attribute.fixed
@@ -80,6 +80,14 @@ pub mod split {
 #[allow(clippy::single_component_path_imports)]
 use regex;
 
+mod module {
+    pub(crate) struct Struct;
+}
+
+#[rustfmt::skip]
+#[allow(unused_import_braces)]
+use module::{Struct};
+
 fn main() {
     test_indented_attr();
 }
diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs
index 00cfa8f5d54..d6aa7fa242c 100644
--- a/tests/ui/useless_attribute.rs
+++ b/tests/ui/useless_attribute.rs
@@ -80,6 +80,14 @@ pub mod split {
 #[allow(clippy::single_component_path_imports)]
 use regex;
 
+mod module {
+    pub(crate) struct Struct;
+}
+
+#[rustfmt::skip]
+#[allow(unused_import_braces)]
+use module::{Struct};
+
 fn main() {
     test_indented_attr();
 }