Use more slice patterns inside the compiler
This commit is contained in:
parent
60d146580c
commit
c4c518d2d4
40 changed files with 191 additions and 221 deletions
|
@ -694,12 +694,12 @@ impl<'a> Parser<'a> {
|
|||
// `foo: `
|
||||
ExprKind::Path(None, ast::Path { segments, .. }),
|
||||
token::Ident(kw::For | kw::Loop | kw::While, IdentIsRaw::No),
|
||||
) if segments.len() == 1 => {
|
||||
) if let [segment] = segments.as_slice() => {
|
||||
let snapshot = self.create_snapshot_for_diagnostic();
|
||||
let label = Label {
|
||||
ident: Ident::from_str_and_span(
|
||||
&format!("'{}", segments[0].ident),
|
||||
segments[0].ident.span,
|
||||
&format!("'{}", segment.ident),
|
||||
segment.ident.span,
|
||||
),
|
||||
};
|
||||
match self.parse_expr_labeled(label, false) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue