From eb10a58fa08afe665eea5dde70cee6a92bed037e Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Sat, 18 Jan 2025 07:44:37 +0000 Subject: [PATCH] use slice patterns for checking for elements of slice --- compiler/rustc_resolve/src/diagnostics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 59de7e369bdf..1bcba001047b 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2245,13 +2245,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> Option<(Vec, Option)> { debug!("make_path_suggestion: span={:?} path={:?}", span, path); - match (path.get(0), path.get(1)) { + match path[..] { // `{{root}}::ident::...` on both editions. // On 2015 `{{root}}` is usually added implicitly. - (Some(fst), Some(snd)) + [fst, snd, ..] if fst.ident.name == kw::PathRoot && !snd.ident.is_path_segment_keyword() => {} // `ident::...` on 2018. - (Some(fst), _) + [fst, ..] if fst.ident.span.at_least_rust_2018() && !fst.ident.is_path_segment_keyword() => { // Insert a placeholder that's later replaced by `self`/`super`/etc.