about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-12 08:25:26 +0000
committerbors <bors@rust-lang.org>2024-08-12 08:25:26 +0000
commita25ec22901e387d076eac487608a172d3b37390e (patch)
treef05489e27b891f15338149d09cd053f1eecc08a1 /compiler/rustc_parse/src/parser/expr.rs
parent3456432db1cb33322702b8a2585d5ffe13c4fd43 (diff)
parent14f9284ebecc4d7a6e68bf782720563a5e317888 (diff)
downloadrust-a25ec22901e387d076eac487608a172d3b37390e.tar.gz
rust-a25ec22901e387d076eac487608a172d3b37390e.zip
Auto merge of #3801 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index ccf8dcdf0b6..cf5d65708ab 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -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) {