diff options
| author | Russell Cohen <russell.r.cohen@gmail.com> | 2020-03-29 12:02:28 -0400 |
|---|---|---|
| committer | Russell Cohen <russell.r.cohen@gmail.com> | 2020-03-29 12:02:28 -0400 |
| commit | bceab25d6c206a7b92716e0c9e9a89b97d131e8e (patch) | |
| tree | bb0b8130ef35101355653aaea12f800a98a11de6 /src/librustc_parse | |
| parent | 82b2989ae0dbb1166289a360620e07865135a5e8 (diff) | |
Cleanup match expression
Diffstat (limited to 'src/librustc_parse')
| -rw-r--r-- | src/librustc_parse/parser/diagnostics.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs index 2fc20e15c5a..e542588d8b5 100644 --- a/src/librustc_parse/parser/diagnostics.rs +++ b/src/librustc_parse/parser/diagnostics.rs @@ -6,7 +6,7 @@ use rustc_ast::ast::{ }; use rustc_ast::ast::{AttrVec, ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind}; use rustc_ast::ptr::P; -use rustc_ast::token::{self, Lit, LitKind, Token, TokenKind}; +use rustc_ast::token::{self, Lit, LitKind, TokenKind}; use rustc_ast::util::parser::AssocOp; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; @@ -287,14 +287,10 @@ impl<'a> Parser<'a> { } fn check_too_many_raw_str_terminators(&mut self, err: &mut DiagnosticBuilder<'_>) -> bool { - let prev_token_raw_str = match self.prev_token { - Token { - kind: - TokenKind::Literal(Lit { - kind: LitKind::StrRaw(n) | LitKind::ByteStrRaw(n), .. - }), - .. - } => Some(n), + let prev_token_raw_str = match self.prev_token.kind { + TokenKind::Literal(Lit { + kind: LitKind::StrRaw(n) | LitKind::ByteStrRaw(n), .. + }) => Some(n), _ => None, }; @@ -523,7 +519,7 @@ impl<'a> Parser<'a> { .unwrap_or_else(|_| pprust::expr_to_string(&e)) }; err.span_suggestion_verbose( - inner_op.span.shrink_to_hi(), + inner_op.span.shrink_to_hi(), "split the comparison into two", format!(" && {}", expr_to_str(&r1)), Applicability::MaybeIncorrect, @@ -1118,7 +1114,7 @@ impl<'a> Parser<'a> { self.look_ahead(2, |t| t.is_ident()) || self.look_ahead(1, |t| t == &token::ModSep) && (self.look_ahead(2, |t| t.is_ident()) || // `foo:bar::baz` - self.look_ahead(2, |t| t == &token::Lt)) // `foo:bar::<baz>` + self.look_ahead(2, |t| t == &token::Lt)) // `foo:bar::<baz>` } pub(super) fn recover_seq_parse_error( |
