Skip to content

Commit

Permalink
use slice patterns for checking for elements of slice
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamofek committed Jan 18, 2025
1 parent 37a3346 commit eb10a58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2245,13 +2245,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
) -> Option<(Vec<Segment>, Option<String>)> {
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.
Expand Down

0 comments on commit eb10a58

Please sign in to comment.