This commit is contained in:
Piotr Mikulski 2021-12-23 21:46:21 -08:00
parent ab77c924e9
commit 8b19845ffb

View file

@ -5,8 +5,6 @@ use clippy_utils::{
diagnostics::span_lint_and_sugg, is_default_equivalent_ctor, is_diag_trait_item, is_trait_item,
source::snippet_with_applicability, ty::is_type_diagnostic_item,
};
use rustc_hir::ExprKind;
use rustc_errors::Applicability;
use rustc_hir as hir;
use rustc_lint::LateContext;
@ -26,7 +24,7 @@ pub(super) fn check<'tcx>(
let is_result = is_type_diagnostic_item(cx, recv_ty, sym::Result);
let is_default_eq = match &u_arg.kind {
ExprKind::Path(qpath) => {
hir::ExprKind::Path(qpath) => {
if let Some(repl_def_id) = cx.qpath_res(qpath, u_arg.hir_id).opt_def_id() {
if is_diag_trait_item(cx, repl_def_id, sym::Default)
|| is_default_equivalent_ctor(cx, repl_def_id, qpath)