From 5b6ba204a7de1d5c694a7b25269a25ee68c98830 Mon Sep 17 00:00:00 2001 From: y21 <30553356+y21@users.noreply.github.com> Date: Wed, 14 Jun 2023 17:01:57 +0200 Subject: [PATCH] fmt --- clippy_lints/src/derivable_impls.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clippy_lints/src/derivable_impls.rs b/clippy_lints/src/derivable_impls.rs index 618214f4a..4ea58c477 100644 --- a/clippy_lints/src/derivable_impls.rs +++ b/clippy_lints/src/derivable_impls.rs @@ -78,12 +78,10 @@ fn is_path_self(e: &Expr<'_>) -> bool { fn contains_trait_object(cx: &LateContext<'_>, ty: ty::Ty<'_>) -> bool { match ty.kind() { - ty::TyKind::Ref(_, ty, _) => { - contains_trait_object(cx, *ty) - }, + ty::TyKind::Ref(_, ty, _) => contains_trait_object(cx, *ty), ty::TyKind::Adt(def, substs) => { def.is_box() && substs[0].as_type().map_or(false, |ty| contains_trait_object(cx, ty)) - } + }, ty::TyKind::Dynamic(..) => true, _ => false, } @@ -119,7 +117,7 @@ fn check_struct<'tcx>( let is_default_without_adjusts = |expr| { is_default_equivalent(cx, expr) && typeck_results.expr_adjustments(expr).iter().all(|adj| { - !matches!(adj.kind, Adjust::Pointer(PointerCast::Unsize) + !matches!(adj.kind, Adjust::Pointer(PointerCast::Unsize) if contains_trait_object(cx, adj.target)) }) };