Skip to content

Commit 40c4e05

Browse files
authored
Rollup merge of #136242 - samueltardieu:remove-match-def-path, r=flip1995
Remove `LateContext::match_def_path()` This function was only kept for Clippy use. The last use in Clippy was removed in c9315bc.
2 parents 01e4f19 + 0bb3d52 commit 40c4e05

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

compiler/rustc_lint/src/context.rs

+1-25
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! overview of how lints are implemented.
55
66
use std::cell::Cell;
7-
use std::{iter, slice};
7+
use std::slice;
88

99
use rustc_data_structures::fx::FxIndexMap;
1010
use rustc_data_structures::sync;
@@ -718,30 +718,6 @@ impl<'tcx> LateContext<'tcx> {
718718
}
719719
}
720720

721-
/// Check if a `DefId`'s path matches the given absolute type path usage.
722-
///
723-
/// Anonymous scopes such as `extern` imports are matched with `kw::Empty`;
724-
/// inherent `impl` blocks are matched with the name of the type.
725-
///
726-
/// Instead of using this method, it is often preferable to instead use
727-
/// `rustc_diagnostic_item` or a `lang_item`. This is less prone to errors
728-
/// as paths get invalidated if the target definition moves.
729-
///
730-
/// # Examples
731-
///
732-
/// ```rust,ignore (no context or def id available)
733-
/// if cx.match_def_path(def_id, &[sym::core, sym::option, sym::Option]) {
734-
/// // The given `def_id` is that of an `Option` type
735-
/// }
736-
/// ```
737-
///
738-
/// Used by clippy, but should be replaced by diagnostic items eventually.
739-
pub fn match_def_path(&self, def_id: DefId, path: &[Symbol]) -> bool {
740-
let names = self.get_def_path(def_id);
741-
742-
names.len() == path.len() && iter::zip(names, path).all(|(a, &b)| a == b)
743-
}
744-
745721
/// Gets the absolute path of `def_id` as a vector of `Symbol`.
746722
///
747723
/// # Examples

0 commit comments

Comments
 (0)