Skip to content

Commit a342de3

Browse files
committed
Soft deprecate match_path and match_qpath
1 parent 6ae0835 commit a342de3

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
@@ -349,6 +349,10 @@ pub fn single_segment_path<'tcx>(path: &QPath<'tcx>) -> Option<&'tcx PathSegment
349349
}
350350
}
351351

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

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

0 commit comments

Comments
 (0)