Skip to content

Commit 055b1b4

Browse files
committed
Rename Attribute::tokens (the inherent method).
To distinguish it from the `HasTokens` method.
1 parent 52517ad commit 055b1b4

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
@@ -290,7 +290,7 @@ impl<'a> StripUnconfigured<'a> {
290290
}
291291

292292
fn expand_cfg_meta(&self, attr: &Attribute, (meta, meta_span): (ast::Meta, Span)) -> Attribute {
293-
let orig_tokens = attr.tokens();
293+
let orig_tokens = attr.get_tokens();
294294

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

0 commit comments

Comments
 (0)