Rename Attribute::tokens (the inherent method).

To distinguish it from the `HasTokens` method.
This commit is contained in:
Nicholas Nethercote 2024-07-04 09:04:51 +10:00
parent dd790ab8ef
commit 14b859fa3b
3 changed files with 5 additions and 4 deletions

View File

@ -202,7 +202,8 @@ impl Attribute {
}
}
pub fn tokens(&self) -> TokenStream {
// Named `get_tokens` to distinguish it from the `<Attribute as HasTokens>::tokens` method.
pub fn get_tokens(&self) -> TokenStream {
match &self.kind {
AttrKind::Normal(normal) => TokenStream::new(
normal

View File

@ -227,7 +227,7 @@ impl AttrTokenStream {
let mut stream = TokenStream::default();
for inner_attr in inner_attrs {
stream.push_stream(inner_attr.tokens());
stream.push_stream(inner_attr.get_tokens());
}
stream.push_stream(delim_tokens.clone());
*tree = TokenTree::Delimited(*span, *spacing, *delim, stream);
@ -242,7 +242,7 @@ impl AttrTokenStream {
);
}
for attr in outer_attrs {
res.extend(attr.tokens().0.iter().cloned());
res.extend(attr.get_tokens().0.iter().cloned());
}
res.extend(target_tokens);
}

View File

@ -294,7 +294,7 @@ impl<'a> StripUnconfigured<'a> {
attr: &Attribute,
(item, item_span): (ast::AttrItem, Span),
) -> Attribute {
let orig_tokens = attr.tokens();
let orig_tokens = attr.get_tokens();
// We are taking an attribute of the form `#[cfg_attr(pred, attr)]`
// and producing an attribute of the form `#[attr]`. We