Skip to content

Commit a909520

Browse files
committed
use slice patterns for checking for elements of slice
1 parent ed5f631 commit a909520

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
@@ -2245,13 +2245,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
22452245
) -> Option<(Vec<Segment>, Option<String>)> {
22462246
debug!("make_path_suggestion: span={:?} path={:?}", span, path);
22472247

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

0 commit comments

Comments
 (0)