about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-06 17:41:34 +0000
committerbors <bors@rust-lang.org>2021-04-06 17:41:34 +0000
commit624e8aad325925b43ee5a1fe1774055fdbd82397 (patch)
tree3fd38d4475395821a1a7aa2e1e9a7d264a2b4606
parentbbe1567bc9181b8d7827bb24b1df92a39ab35283 (diff)
parenta342de3bcb405c1be191e906d813feb4b4be2fbf (diff)
downloadrust-624e8aad325925b43ee5a1fe1774055fdbd82397.tar.gz
rust-624e8aad325925b43ee5a1fe1774055fdbd82397.zip
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).
-rw-r--r--clippy_utils/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs
index 0dce0cb5d67..64f86f5f101 100644
--- a/clippy_utils/src/lib.rs
+++ b/clippy_utils/src/lib.rs
@@ -348,6 +348,10 @@ pub fn single_segment_path<'tcx>(path: &QPath<'tcx>) -> Option<&'tcx PathSegment
     }
 }
 
+/// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
+/// entire path or resolved `DefId`. Prefer using `match_def_path`. Consider getting a `DefId` from
+/// `QPath::Resolved.1.res.opt_def_id()`.
+///
 /// Matches a `QPath` against a slice of segment string literals.
 ///
 /// 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 {
     }
 }
 
+/// THIS METHOD IS DEPRECATED and will eventually be removed since it does not match against the
+/// entire path or resolved `DefId`. Prefer using `match_def_path`. Consider getting a `DefId` from
+/// `QPath::Resolved.1.res.opt_def_id()`.
+///
 /// Matches a `Path` against a slice of segment string literals.
 ///
 /// There is also `match_qpath` if you are dealing with a `rustc_hir::QPath` instead of a