Skip to content

Commit

Permalink
Auto merge of #118250 - petrochenkov:optdefkind, r=compiler-errors
Browse files Browse the repository at this point in the history
rustc: Make `def_kind` mandatory for all `DefId`s

Prerequisite for rust-lang/rust#118188.
  • Loading branch information
bors committed Nov 26, 2023
2 parents fffee10 + bafa200 commit a79a7d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/unused_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/useless_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a79a7d6

Please sign in to comment.