about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-01-10 23:53:14 +0100
committerSamuel Tardieu <sam@rfc1149.net>2025-01-29 12:31:20 +0100
commit0bb3d5209e60c41d60b679453fd9e15af16866e6 (patch)
tree7ff6f933d06d68534f555b21a8d795ded56026ba
parent61cc3e51f8bf5c12595a4d61a5ee9de812974b43 (diff)
downloadrust-0bb3d5209e60c41d60b679453fd9e15af16866e6.tar.gz
rust-0bb3d5209e60c41d60b679453fd9e15af16866e6.zip
Remove `LateContext::match_def_path()`
This function was only kept for Clippy use. The last use in Clippy was
removed in c9315bc3953fcf15154df21f788f2f7a5e8d6e7d.
-rw-r--r--compiler/rustc_lint/src/context.rs26
1 files changed, 1 insertions, 25 deletions
diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs
index 50bb1fb942e..e0863aa035c 100644
--- a/compiler/rustc_lint/src/context.rs
+++ b/compiler/rustc_lint/src/context.rs
@@ -4,7 +4,7 @@
 //! overview of how lints are implemented.
 
 use std::cell::Cell;
-use std::{iter, slice};
+use std::slice;
 
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::sync;
@@ -718,30 +718,6 @@ impl<'tcx> LateContext<'tcx> {
         }
     }
 
-    /// Check if a `DefId`'s path matches the given absolute type path usage.
-    ///
-    /// Anonymous scopes such as `extern` imports are matched with `kw::Empty`;
-    /// inherent `impl` blocks are matched with the name of the type.
-    ///
-    /// Instead of using this method, it is often preferable to instead use
-    /// `rustc_diagnostic_item` or a `lang_item`. This is less prone to errors
-    /// as paths get invalidated if the target definition moves.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,ignore (no context or def id available)
-    /// if cx.match_def_path(def_id, &[sym::core, sym::option, sym::Option]) {
-    ///     // The given `def_id` is that of an `Option` type
-    /// }
-    /// ```
-    ///
-    /// Used by clippy, but should be replaced by diagnostic items eventually.
-    pub fn match_def_path(&self, def_id: DefId, path: &[Symbol]) -> bool {
-        let names = self.get_def_path(def_id);
-
-        names.len() == path.len() && iter::zip(names, path).all(|(a, &b)| a == b)
-    }
-
     /// Gets the absolute path of `def_id` as a vector of `Symbol`.
     ///
     /// # Examples