Skip to content

Commit a79a7d6

Browse files
committed
Auto merge of rust-lang#118250 - petrochenkov:optdefkind, r=compiler-errors
rustc: Make `def_kind` mandatory for all `DefId`s Prerequisite for rust-lang#118188.
2 parents fffee10 + bafa200 commit a79a7d6

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clippy_lints/src/unused_async.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAsync {
148148
// statements, so don't lint at all if there are any such paths.
149149
if let Some(def_id) = path.res.opt_def_id()
150150
&& let Some(local_def_id) = def_id.as_local()
151-
&& let Some(DefKind::Fn) = cx.tcx.opt_def_kind(def_id)
151+
&& cx.tcx.def_kind(def_id) == DefKind::Fn
152152
&& cx.tcx.asyncness(def_id).is_async()
153153
&& !is_node_func_call(cx.tcx.hir().get_parent(hir_id), path.span)
154154
{

clippy_lints/src/useless_conversion.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use clippy_utils::sugg::Sugg;
44
use clippy_utils::ty::{is_copy, is_type_diagnostic_item, same_type_and_consts};
55
use clippy_utils::{get_parent_expr, is_trait_method, is_ty_alias, path_to_local};
66
use rustc_errors::Applicability;
7-
use rustc_hir::def::DefKind;
87
use rustc_hir::def_id::DefId;
98
use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, MatchSource, Node, PatKind};
109
use rustc_infer::infer::TyCtxtInferExt;
@@ -208,7 +207,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessConversion {
208207
&& let Some(did) = cx.qpath_res(qpath, recv.hir_id).opt_def_id()
209208
// make sure that the path indeed points to a fn-like item, so that
210209
// `fn_sig` does not ICE. (see #11065)
211-
&& cx.tcx.opt_def_kind(did).is_some_and(DefKind::is_fn_like) =>
210+
&& cx.tcx.def_kind(did).is_fn_like() =>
212211
{
213212
Some((
214213
did,

0 commit comments

Comments
 (0)