Skip to content

Commit 350a34f

Browse files
committed
syntax: Use Token in some more places
1 parent f745e5f commit 350a34f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/libsyntax/attr/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl MetaItemKind {
560560
Some(TokenTree::Token(token)) if token == token::Eq => {
561561
tokens.next();
562562
return if let Some(TokenTree::Token(token)) = tokens.next() {
563-
Lit::from_token(&token, token.span).ok().map(MetaItemKind::NameValue)
563+
Lit::from_token(&token).ok().map(MetaItemKind::NameValue)
564564
} else {
565565
None
566566
};
@@ -605,7 +605,7 @@ impl NestedMetaItem {
605605
where I: Iterator<Item = TokenTree>,
606606
{
607607
if let Some(TokenTree::Token(token)) = tokens.peek() {
608-
if let Ok(lit) = Lit::from_token(token, token.span) {
608+
if let Ok(lit) = Lit::from_token(token) {
609609
tokens.next();
610610
return Some(NestedMetaItem::Literal(lit));
611611
}

src/libsyntax/parse/literal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ impl Lit {
228228
}
229229

230230
/// Converts arbitrary token into an AST literal.
231-
crate fn from_token(token: &TokenKind, span: Span) -> Result<Lit, LitError> {
232-
let lit = match *token {
231+
crate fn from_token(token: &Token) -> Result<Lit, LitError> {
232+
let lit = match token.kind {
233233
token::Ident(name, false) if name == kw::True || name == kw::False =>
234234
token::Lit::new(token::Bool, name, None),
235235
token::Literal(lit) =>
@@ -245,7 +245,7 @@ impl Lit {
245245
_ => return Err(LitError::NotLiteral)
246246
};
247247

248-
Lit::from_lit_token(lit, span)
248+
Lit::from_lit_token(lit, token.span)
249249
}
250250

251251
/// Attempts to recover an AST literal from semantic literal.
@@ -297,7 +297,7 @@ impl<'a> Parser<'a> {
297297
}
298298

299299
let token = recovered.as_ref().unwrap_or(&self.token);
300-
match Lit::from_token(token, token.span) {
300+
match Lit::from_token(token) {
301301
Ok(lit) => {
302302
self.bump();
303303
Ok(lit)

0 commit comments

Comments
 (0)