about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-12 10:26:14 +0000
committerbors <bors@rust-lang.org>2024-09-12 10:26:14 +0000
commite039e72d85f4df363cada8ec45d2fbe14ad403f5 (patch)
tree391cf09938cc7222756a6b48065bf8c11d582d7b
parent131681b4b9c2460d223b5939a273f0356a8e06f5 (diff)
parent7097830a9b6c2d9c56d0b8cea7b0612dc8a53b50 (diff)
downloadrust-e039e72d85f4df363cada8ec45d2fbe14ad403f5.tar.gz
rust-e039e72d85f4df363cada8ec45d2fbe14ad403f5.zip
Auto merge of #13386 - alex-semenyuk:no_lint_on_duplicate_reason, r=xFrednet
Not trigger `duplicated_attributes` on duplicate reasons

As at #13355 we shoudn't  trigger `duplicated_attributes` on duplicate reasons attr
changelog: [`duplicated_attributes`]: not trigger `duplicated_attributes` on duplicate reasons
-rw-r--r--clippy_lints/src/attrs/duplicated_attributes.rs2
-rw-r--r--tests/ui/duplicated_attributes.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/clippy_lints/src/attrs/duplicated_attributes.rs b/clippy_lints/src/attrs/duplicated_attributes.rs
index 40a1c4e2884..199e07565b0 100644
--- a/clippy_lints/src/attrs/duplicated_attributes.rs
+++ b/clippy_lints/src/attrs/duplicated_attributes.rs
@@ -36,7 +36,7 @@ fn check_duplicated_attr(
     }
     let Some(ident) = attr.ident() else { return };
     let name = ident.name;
-    if name == sym::doc || name == sym::cfg_attr || name == sym::rustc_on_unimplemented {
+    if name == sym::doc || name == sym::cfg_attr || name == sym::rustc_on_unimplemented || name == sym::reason {
         // FIXME: Would be nice to handle `cfg_attr` as well. Only problem is to check that cfg
         // conditions are the same.
         // `#[rustc_on_unimplemented]` contains duplicated subattributes, that's expected.
diff --git a/tests/ui/duplicated_attributes.rs b/tests/ui/duplicated_attributes.rs
index 97cf4a69682..874f5d22075 100644
--- a/tests/ui/duplicated_attributes.rs
+++ b/tests/ui/duplicated_attributes.rs
@@ -27,4 +27,8 @@ trait Abc {}
 #[proc_macro_attr::duplicated_attr()] // Should not warn!
 fn babar() {}
 
+#[allow(missing_docs, reason = "library for internal use only")]
+#[allow(exported_private_dependencies, reason = "library for internal use only")]
+fn duplicate_reason() {}
+
 fn main() {}