Skip to content

Commit bceab25

Browse files
committed
Cleanup match expression
1 parent 82b2989 commit bceab25

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/librustc_parse/parser/diagnostics.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_ast::ast::{
66
};
77
use rustc_ast::ast::{AttrVec, ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind};
88
use rustc_ast::ptr::P;
9-
use rustc_ast::token::{self, Lit, LitKind, Token, TokenKind};
9+
use rustc_ast::token::{self, Lit, LitKind, TokenKind};
1010
use rustc_ast::util::parser::AssocOp;
1111
use rustc_ast_pretty::pprust;
1212
use rustc_data_structures::fx::FxHashSet;
@@ -287,14 +287,10 @@ impl<'a> Parser<'a> {
287287
}
288288

289289
fn check_too_many_raw_str_terminators(&mut self, err: &mut DiagnosticBuilder<'_>) -> bool {
290-
let prev_token_raw_str = match self.prev_token {
291-
Token {
292-
kind:
293-
TokenKind::Literal(Lit {
294-
kind: LitKind::StrRaw(n) | LitKind::ByteStrRaw(n), ..
295-
}),
296-
..
297-
} => Some(n),
290+
let prev_token_raw_str = match self.prev_token.kind {
291+
TokenKind::Literal(Lit {
292+
kind: LitKind::StrRaw(n) | LitKind::ByteStrRaw(n), ..
293+
}) => Some(n),
298294
_ => None,
299295
};
300296

@@ -523,7 +519,7 @@ impl<'a> Parser<'a> {
523519
.unwrap_or_else(|_| pprust::expr_to_string(&e))
524520
};
525521
err.span_suggestion_verbose(
526-
inner_op.span.shrink_to_hi(),
522+
inner_op.span.shrink_to_hi(),
527523
"split the comparison into two",
528524
format!(" && {}", expr_to_str(&r1)),
529525
Applicability::MaybeIncorrect,
@@ -1118,7 +1114,7 @@ impl<'a> Parser<'a> {
11181114
self.look_ahead(2, |t| t.is_ident())
11191115
|| self.look_ahead(1, |t| t == &token::ModSep)
11201116
&& (self.look_ahead(2, |t| t.is_ident()) || // `foo:bar::baz`
1121-
self.look_ahead(2, |t| t == &token::Lt)) // `foo:bar::<baz>`
1117+
self.look_ahead(2, |t| t == &token::Lt)) // `foo:bar::<baz>`
11221118
}
11231119

11241120
pub(super) fn recover_seq_parse_error(

0 commit comments

Comments
 (0)