Skip to content

Commit d913c37

Browse files
committed
use slice patterns for checking for elements of slice
1 parent f7ebbf9 commit d913c37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2243,13 +2243,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
22432243
) -> Option<(Vec<Segment>, Option<String>)> {
22442244
debug!("make_path_suggestion: span={:?} path={:?}", span, path);
22452245

2246-
match (path.get(0), path.get(1)) {
2246+
match path[..] {
22472247
// `{{root}}::ident::...` on both editions.
22482248
// On 2015 `{{root}}` is usually added implicitly.
2249-
(Some(fst), Some(snd))
2249+
[fst, snd, ..]
22502250
if fst.ident.name == kw::PathRoot && !snd.ident.is_path_segment_keyword() => {}
22512251
// `ident::...` on 2018.
2252-
(Some(fst), _)
2252+
[fst, ..]
22532253
if fst.ident.span.at_least_rust_2018() && !fst.ident.is_path_segment_keyword() =>
22542254
{
22552255
// Insert a placeholder that's later replaced by `self`/`super`/etc.

0 commit comments

Comments
 (0)