about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2020-11-25 23:04:38 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-03-09 19:09:34 +0100
commit4bb07bedf5a5eae0e97ef0b3ab238cc64ace3323 (patch)
tree9d145484995b8dfc825af06db8a74a55858e319e /compiler/rustc_lint/src
parent8e816056a5a440ca789f543481c8478514c35de6 (diff)
downloadrust-4bb07bedf5a5eae0e97ef0b3ab238cc64ace3323.tar.gz
rust-4bb07bedf5a5eae0e97ef0b3ab238cc64ace3323.zip
Visit attributes in one go.
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/unused.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index 997b9136320..67946dfb292 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -406,6 +406,8 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAttributes {
         if !cx.sess().is_attr_used(attr) {
             debug!("emitting warning for: {:?}", attr);
             cx.struct_span_lint(UNUSED_ATTRIBUTES, attr.span, |lint| {
+                // Mark as used to avoid duplicate warnings.
+                cx.sess().mark_attr_used(attr);
                 lint.build("unused attribute").emit()
             });
             // Is it a builtin attribute that must be used at the crate level?