From 14f9f2b69d5306936296ce7a2e0db7809fd6a113 Mon Sep 17 00:00:00 2001 From: Andy-Python-Programmer Date: Wed, 5 Oct 2022 18:59:01 +1100 Subject: [PATCH] lint::unsafe_removed_from_name: fix false positive result when allowed * Allowing `unsafe_removed_from_name` on imports produces a false positive on `useless_attribute`. Fixes: #9197 Signed-off-by: Andy-Python-Programmer --- clippy_lints/src/attrs.rs | 3 ++- tests/ui/unsafe_removed_from_name.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 5f45c69d7f9..0bd1f8b784e 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -357,7 +357,8 @@ impl<'tcx> LateLintPass<'tcx> for Attributes { "wildcard_imports" | "enum_glob_use" | "redundant_pub_crate" - | "macro_use_imports", + | "macro_use_imports" + | "unsafe_removed_from_name", ) }) { diff --git a/tests/ui/unsafe_removed_from_name.rs b/tests/ui/unsafe_removed_from_name.rs index cde4e96d668..d29888ac62f 100644 --- a/tests/ui/unsafe_removed_from_name.rs +++ b/tests/ui/unsafe_removed_from_name.rs @@ -24,4 +24,7 @@ use mod_with_some_unsafe_things::Unsafe as LieAboutModSafety; use mod_with_some_unsafe_things::Safe as IPromiseItsSafeThisTime; use mod_with_some_unsafe_things::Unsafe as SuperUnsafeModThing; +#[allow(clippy::unsafe_removed_from_name)] +use mod_with_some_unsafe_things::Unsafe as SuperSafeThing; + fn main() {}