Rollup merge of #139615 - nnethercote:rm-name_or_empty, r=jdonszelmann

Remove `name_or_empty`

Another step towards #137978.

r? ``@jdonszelmann``
This commit is contained in:
Matthias Krüger 2025-04-18 05:16:29 +02:00 committed by GitHub
commit 540fb228af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 309 additions and 226 deletions

View file

@ -1237,7 +1237,7 @@ impl AttributeExt for Attribute {
Attribute::Parsed(AttributeKind::DocComment { kind, comment, .. }) => {
Some((*comment, *kind))
}
Attribute::Unparsed(_) if self.name_or_empty() == sym::doc => {
Attribute::Unparsed(_) if self.has_name(sym::doc) => {
self.value_str().map(|s| (s, CommentKind::Line))
}
_ => None,
@ -1262,8 +1262,8 @@ impl Attribute {
}
#[inline]
pub fn name_or_empty(&self) -> Symbol {
AttributeExt::name_or_empty(self)
pub fn name(&self) -> Option<Symbol> {
AttributeExt::name(self)
}
#[inline]
@ -1301,6 +1301,11 @@ impl Attribute {
AttributeExt::has_name(self, name)
}
#[inline]
pub fn has_any_name(&self, names: &[Symbol]) -> bool {
AttributeExt::has_any_name(self, names)
}
#[inline]
pub fn span(&self) -> Span {
AttributeExt::span(self)