about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-26 04:44:20 +0000
committerbors <bors@rust-lang.org>2023-11-26 04:44:20 +0000
commita79a7d6510b3a32fa3b3832b3b9ea20a0dc8bc52 (patch)
tree961db34482af8cab30e58794bf26ca2a9c01b584
parentfffee10632783de2ff5f5321ee7cf74a6b264803 (diff)
parentbafa200f6edc454b423d847db88d867584c10e18 (diff)
Auto merge of #118250 - petrochenkov:optdefkind, r=compiler-errors
rustc: Make `def_kind` mandatory for all `DefId`s

Prerequisite for https://github.com/rust-lang/rust/pull/118188.
-rw-r--r--clippy_lints/src/unused_async.rs2
-rw-r--r--clippy_lints/src/useless_conversion.rs3
2 files changed, 2 insertions, 3 deletions
diff --git a/clippy_lints/src/unused_async.rs b/clippy_lints/src/unused_async.rs
index aea72c798be..780ece3677d 100644
--- a/clippy_lints/src/unused_async.rs
+++ b/clippy_lints/src/unused_async.rs
@@ -148,7 +148,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAsync {
         // statements, so don't lint at all if there are any such paths.
         if let Some(def_id) = path.res.opt_def_id()
             && let Some(local_def_id) = def_id.as_local()
-            && let Some(DefKind::Fn) = cx.tcx.opt_def_kind(def_id)
+            && cx.tcx.def_kind(def_id) == DefKind::Fn
             && cx.tcx.asyncness(def_id).is_async()
             && !is_node_func_call(cx.tcx.hir().get_parent(hir_id), path.span)
         {
diff --git a/clippy_lints/src/useless_conversion.rs b/clippy_lints/src/useless_conversion.rs
index 52327b82e84..7aed1d6e30b 100644
--- a/clippy_lints/src/useless_conversion.rs
+++ b/clippy_lints/src/useless_conversion.rs
@@ -4,7 +4,6 @@ use clippy_utils::sugg::Sugg;
 use clippy_utils::ty::{is_copy, is_type_diagnostic_item, same_type_and_consts};
 use clippy_utils::{get_parent_expr, is_trait_method, is_ty_alias, path_to_local};
 use rustc_errors::Applicability;
-use rustc_hir::def::DefKind;
 use rustc_hir::def_id::DefId;
 use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, MatchSource, Node, PatKind};
 use rustc_infer::infer::TyCtxtInferExt;
@@ -208,7 +207,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessConversion {
                                     && let Some(did) = cx.qpath_res(qpath, recv.hir_id).opt_def_id()
                                     // make sure that the path indeed points to a fn-like item, so that
                                     // `fn_sig` does not ICE. (see #11065)
-                                    && cx.tcx.opt_def_kind(did).is_some_and(DefKind::is_fn_like) =>
+                                    && cx.tcx.def_kind(did).is_fn_like() =>
                             {
                                 Some((
                                     did,