Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 14b859f

Browse files
committed
Rename Attribute::tokens (the inherent method).
To distinguish it from the `HasTokens` method.
1 parent dd790ab commit 14b859f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ impl Attribute {
202202
}
203203
}
204204

205-
pub fn tokens(&self) -> TokenStream {
205+
// Named `get_tokens` to distinguish it from the `<Attribute as HasTokens>::tokens` method.
206+
pub fn get_tokens(&self) -> TokenStream {
206207
match &self.kind {
207208
AttrKind::Normal(normal) => TokenStream::new(
208209
normal

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl AttrTokenStream {
227227

228228
let mut stream = TokenStream::default();
229229
for inner_attr in inner_attrs {
230-
stream.push_stream(inner_attr.tokens());
230+
stream.push_stream(inner_attr.get_tokens());
231231
}
232232
stream.push_stream(delim_tokens.clone());
233233
*tree = TokenTree::Delimited(*span, *spacing, *delim, stream);
@@ -242,7 +242,7 @@ impl AttrTokenStream {
242242
);
243243
}
244244
for attr in outer_attrs {
245-
res.extend(attr.tokens().0.iter().cloned());
245+
res.extend(attr.get_tokens().0.iter().cloned());
246246
}
247247
res.extend(target_tokens);
248248
}

compiler/rustc_expand/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<'a> StripUnconfigured<'a> {
294294
attr: &Attribute,
295295
(item, item_span): (ast::AttrItem, Span),
296296
) -> Attribute {
297-
let orig_tokens = attr.tokens();
297+
let orig_tokens = attr.get_tokens();
298298

299299
// We are taking an attribute of the form `#[cfg_attr(pred, attr)]`
300300
// and producing an attribute of the form `#[attr]`. We

0 commit comments

Comments
 (0)