We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Attribute::check_name
1 parent 0a88346 commit 05f414bCopy full SHA for 05f414b
src/librustc_ast/attr/mod.rs
@@ -175,7 +175,11 @@ impl Attribute {
175
176
/// Returns `true` if the attribute's path matches the argument.
177
/// If it matches, then the attribute is marked as used.
178
- /// Should only be used by rustc, other tools can use `has_name` instead.
+ /// Should only be used by rustc, other tools can use `has_name` instead,
179
+ /// because only rustc is supposed to report the `unused_attributes` lint.
180
+ /// `MetaItem` and `NestedMetaItem` are produced by "lowering" an `Attribute`
181
+ /// and don't have identity, so they only has the `has_name` method,
182
+ /// and you need to mark the original `Attribute` as used when necessary.
183
pub fn check_name(&self, name: Symbol) -> bool {
184
let matches = self.has_name(name);
185
if matches {
0 commit comments