1
Fork 0

Visit attributes in one go.

This commit is contained in:
Camille GILLOT 2020-11-25 23:04:38 +01:00
parent 8e816056a5
commit 4bb07bedf5
3 changed files with 36 additions and 45 deletions

View file

@ -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?