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
This commit is contained in:
bors 2024-02-22 22:47:03 +00:00
commit 5a52c8aee9
3 changed files with 17 additions and 0 deletions

View File

@ -564,6 +564,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
|| is_word(lint, sym::deprecated) || is_word(lint, sym::deprecated)
|| is_word(lint, sym!(unreachable_pub)) || is_word(lint, sym!(unreachable_pub))
|| is_word(lint, sym!(unused)) || is_word(lint, sym!(unused))
|| is_word(lint, sym!(unused_import_braces))
|| extract_clippy_lint(lint).map_or(false, |s| { || extract_clippy_lint(lint).map_or(false, |s| {
matches!( matches!(
s.as_str(), s.as_str(),

View File

@ -80,6 +80,14 @@ pub mod split {
#[allow(clippy::single_component_path_imports)] #[allow(clippy::single_component_path_imports)]
use regex; use regex;
mod module {
pub(crate) struct Struct;
}
#[rustfmt::skip]
#[allow(unused_import_braces)]
use module::{Struct};
fn main() { fn main() {
test_indented_attr(); test_indented_attr();
} }

View File

@ -80,6 +80,14 @@ pub mod split {
#[allow(clippy::single_component_path_imports)] #[allow(clippy::single_component_path_imports)]
use regex; use regex;
mod module {
pub(crate) struct Struct;
}
#[rustfmt::skip]
#[allow(unused_import_braces)]
use module::{Struct};
fn main() { fn main() {
test_indented_attr(); test_indented_attr();
} }