Skip to content

Commit fcb9a38

Browse files
committed
dogfood
1 parent 5b6ba20 commit fcb9a38

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clippy_lints/src/derivable_impls.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ fn is_path_self(e: &Expr<'_>) -> bool {
7676
}
7777
}
7878

79-
fn contains_trait_object(cx: &LateContext<'_>, ty: ty::Ty<'_>) -> bool {
79+
fn contains_trait_object(ty: ty::Ty<'_>) -> bool {
8080
match ty.kind() {
81-
ty::TyKind::Ref(_, ty, _) => contains_trait_object(cx, *ty),
82-
ty::TyKind::Adt(def, substs) => {
83-
def.is_box() && substs[0].as_type().map_or(false, |ty| contains_trait_object(cx, ty))
84-
},
81+
ty::TyKind::Ref(_, ty, _) => contains_trait_object(*ty),
82+
ty::TyKind::Adt(def, substs) => def.is_box() && substs[0].as_type().map_or(false, contains_trait_object),
8583
ty::TyKind::Dynamic(..) => true,
8684
_ => false,
8785
}
@@ -118,13 +116,13 @@ fn check_struct<'tcx>(
118116
is_default_equivalent(cx, expr)
119117
&& typeck_results.expr_adjustments(expr).iter().all(|adj| {
120118
!matches!(adj.kind, Adjust::Pointer(PointerCast::Unsize)
121-
if contains_trait_object(cx, adj.target))
119+
if contains_trait_object(adj.target))
122120
})
123121
};
124122

125123
let should_emit = match peel_blocks(func_expr).kind {
126-
ExprKind::Tup(fields) => fields.iter().all(|e| is_default_without_adjusts(e)),
127-
ExprKind::Call(callee, args) if is_path_self(callee) => args.iter().all(|e| is_default_without_adjusts(e)),
124+
ExprKind::Tup(fields) => fields.iter().all(is_default_without_adjusts),
125+
ExprKind::Call(callee, args) if is_path_self(callee) => args.iter().all(is_default_without_adjusts),
128126
ExprKind::Struct(_, fields, _) => fields.iter().all(|ef| is_default_without_adjusts(ef.expr)),
129127
_ => false,
130128
};

0 commit comments

Comments
 (0)