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
|
@ -672,7 +672,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
match &expr.kind {
|
||||
ExprKind::Path(None, ast::Path { segments, .. })
|
||||
if segments.len() == 1 =>
|
||||
if let [segment] = segments.as_slice() =>
|
||||
{
|
||||
if self.token == token::Colon
|
||||
&& self.look_ahead(1, |token| {
|
||||
|
@ -689,8 +689,8 @@ impl<'a> Parser<'a> {
|
|||
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