diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-05 13:24:54 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-06 14:04:02 +0300 |
| commit | 350a34f85c0ed53315a2114f0001cfea4fe116d9 (patch) | |
| tree | e9a92eaa132a515754574e39c588cbb01e6b5ef6 /src/libsyntax/parse | |
| parent | f745e5f9b676be02cc1dfbab0bfb338dc72b4dd3 (diff) | |
| download | rust-350a34f85c0ed53315a2114f0001cfea4fe116d9.tar.gz rust-350a34f85c0ed53315a2114f0001cfea4fe116d9.zip | |
syntax: Use `Token` in some more places
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/literal.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/parse/literal.rs b/src/libsyntax/parse/literal.rs index 7b27304071c..7b213655abd 100644 --- a/src/libsyntax/parse/literal.rs +++ b/src/libsyntax/parse/literal.rs @@ -228,8 +228,8 @@ impl Lit { } /// Converts arbitrary token into an AST literal. - crate fn from_token(token: &TokenKind, span: Span) -> Result<Lit, LitError> { - let lit = match *token { + crate fn from_token(token: &Token) -> Result<Lit, LitError> { + let lit = match token.kind { token::Ident(name, false) if name == kw::True || name == kw::False => token::Lit::new(token::Bool, name, None), token::Literal(lit) => @@ -245,7 +245,7 @@ impl Lit { _ => return Err(LitError::NotLiteral) }; - Lit::from_lit_token(lit, span) + Lit::from_lit_token(lit, token.span) } /// Attempts to recover an AST literal from semantic literal. @@ -297,7 +297,7 @@ impl<'a> Parser<'a> { } let token = recovered.as_ref().unwrap_or(&self.token); - match Lit::from_token(token, token.span) { + match Lit::from_token(token) { Ok(lit) => { self.bump(); Ok(lit) |
