diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-24 02:04:56 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-06 14:01:57 +0300 |
| commit | eac3846b65b068a5cbdfafc786e258554b875dae (patch) | |
| tree | 7f8aeac93382bd664ac49d1791181cf6d659dcc3 /src/libsyntax/parse | |
| parent | daf1ed0e98e75c64c3b883fd845b37bfa42358de (diff) | |
| download | rust-eac3846b65b068a5cbdfafc786e258554b875dae.tar.gz rust-eac3846b65b068a5cbdfafc786e258554b875dae.zip | |
Always use token kinds through `token` module rather than `Token` type
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/diagnostics.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 4 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index 5df22f28797..fc09943d4f5 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -294,7 +294,7 @@ impl<'a> Parser<'a> { Applicability::MaybeIncorrect, ); } - let sp = if self.token == token::Token::Eof { + let sp = if self.token == token::Eof { // This is EOF, don't want to point at the following char, but rather the last token self.prev_span } else { @@ -732,7 +732,7 @@ impl<'a> Parser<'a> { let this_token_str = self.this_token_descr(); let (prev_sp, sp) = match (&self.token, self.subparser_name) { // Point at the end of the macro call when reaching end of macro arguments. - (token::Token::Eof, Some(_)) => { + (token::Eof, Some(_)) => { let sp = self.sess.source_map().next_point(self.span); (sp, sp) } @@ -740,14 +740,14 @@ impl<'a> Parser<'a> { // This happens when the parser finds an empty TokenStream. _ if self.prev_span == DUMMY_SP => (self.span, self.span), // EOF, don't want to point at the following char, but rather the last token. - (token::Token::Eof, None) => (self.prev_span, self.span), + (token::Eof, None) => (self.prev_span, self.span), _ => (self.sess.source_map().next_point(self.prev_span), self.span), }; let msg = format!( "expected `{}`, found {}", token_str, match (&self.token, self.subparser_name) { - (token::Token::Eof, Some(origin)) => format!("end of {}", origin), + (token::Eof, Some(origin)) => format!("end of {}", origin), _ => this_token_str, }, ); @@ -1215,7 +1215,7 @@ impl<'a> Parser<'a> { crate fn expected_expression_found(&self) -> DiagnosticBuilder<'a> { let (span, msg) = match (&self.token, self.subparser_name) { - (&token::Token::Eof, Some(origin)) => { + (&token::Eof, Some(origin)) => { let sp = self.sess.source_map().next_point(self.span); (sp, format!("expected expression, found end of {}", origin)) } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index f7a7aba9ecb..60d04ae9d94 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -311,7 +311,7 @@ pub fn maybe_file_to_stream( for unmatched in unmatched_braces { let mut db = sess.span_diagnostic.struct_span_err(unmatched.found_span, &format!( "incorrect close delimiter: `{}`", - token_to_string(&token::Token::CloseDelim(unmatched.found_delim)), + token_to_string(&token::CloseDelim(unmatched.found_delim)), )); db.span_label(unmatched.found_span, "incorrect close delimiter"); if let Some(sp) = unmatched.candidate_span { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 790013f6eb1..8409e300fc9 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3359,7 +3359,7 @@ impl<'a> Parser<'a> { let discriminant = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; if let Err(mut e) = self.expect(&token::OpenDelim(token::Brace)) { - if self.token == token::Token::Semi { + if self.token == token::Semi { e.span_suggestion_short( match_span, "try removing this `match`", @@ -5920,7 +5920,7 @@ impl<'a> Parser<'a> { while !self.eat(&token::CloseDelim(token::Brace)) { if let token::DocComment(_) = self.token { if self.look_ahead(1, - |tok| tok == &token::Token::CloseDelim(token::Brace)) { + |tok| tok == &token::CloseDelim(token::Brace)) { let mut err = self.diagnostic().struct_span_err_with_code( self.span, "found a documentation comment that doesn't document anything", @@ -6796,7 +6796,7 @@ impl<'a> Parser<'a> { let mut replacement = vec![]; let mut fixed_crate_name = false; // Accept `extern crate name-like-this` for better diagnostics - let dash = token::Token::BinOp(token::BinOpToken::Minus); + let dash = token::BinOp(token::BinOpToken::Minus); if self.token == dash { // Do not include `-` as part of the expected tokens list while self.eat(&dash) { fixed_crate_name = true; @@ -7869,7 +7869,7 @@ pub fn emit_unclosed_delims(unclosed_delims: &mut Vec<UnmatchedBrace>, handler: for unmatched in unclosed_delims.iter() { let mut err = handler.struct_span_err(unmatched.found_span, &format!( "incorrect close delimiter: `{}`", - pprust::token_to_string(&token::Token::CloseDelim(unmatched.found_delim)), + pprust::token_to_string(&token::CloseDelim(unmatched.found_delim)), )); err.span_label(unmatched.found_span, "incorrect close delimiter"); if let Some(sp) = unmatched.candidate_span { diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 47185df8d61..d54d12698bb 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -691,11 +691,11 @@ impl Nonterminal { prepend_attrs(sess, &item.attrs, item.tokens.as_ref(), span) } Nonterminal::NtIdent(ident, is_raw) => { - let token = Token::Ident(ident, is_raw); + let token = Ident(ident, is_raw); Some(TokenTree::Token(ident.span, token).into()) } Nonterminal::NtLifetime(ident) => { - let token = Token::Lifetime(ident); + let token = Lifetime(ident); Some(TokenTree::Token(ident.span, token).into()) } Nonterminal::NtTT(ref tt) => { |
