Skip to content

Commit 624e8aa

Browse files
committed
Auto merge of #7044 - camsteffen:match-path, r=Manishearth
Soft deprecate match_path and match_qpath changelog: none From zulip [disucssion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/match_.5Bq.5Dpath.20is.20bad.3F).
2 parents bbe1567 + a342de3 commit 624e8aa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

clippy_utils/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ pub fn single_segment_path<'tcx>(path: &QPath<'tcx>) -> Option<&'tcx PathSegment
348348
}
349349
}
350350

351+
/// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
352+
/// entire path or resolved `DefId`. Prefer using `match_def_path`. Consider getting a `DefId` from
353+
/// `QPath::Resolved.1.res.opt_def_id()`.
354+
///
351355
/// Matches a `QPath` against a slice of segment string literals.
352356
///
353357
/// There is also `match_path` if you are dealing with a `rustc_hir::Path` instead of a
@@ -375,6 +379,10 @@ pub fn match_qpath(path: &QPath<'_>, segments: &[&str]) -> bool {
375379
}
376380
}
377381

382+
/// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
383+
/// entire path or resolved `DefId`. Prefer using `match_def_path`. Consider getting a `DefId` from
384+
/// `QPath::Resolved.1.res.opt_def_id()`.
385+
///
378386
/// Matches a `Path` against a slice of segment string literals.
379387
///
380388
/// There is also `match_qpath` if you are dealing with a `rustc_hir::QPath` instead of a

0 commit comments

Comments
 (0)