Skip to content

Commit f51b5af

Browse files
committed
is_default_equivalent_ctor: check for String once
1 parent 5abee43 commit f51b5af

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clippy_utils/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,10 @@ fn is_default_equivalent_ctor(cx: &LateContext<'_>, def_id: DefId, path: &QPath<
640640
&& let Some(impl_did) = cx.tcx.impl_of_assoc(def_id)
641641
&& let Some(adt) = cx.tcx.type_of(impl_did).instantiate_identity().ty_adt_def()
642642
{
643-
return std_types_symbols.iter().any(|&symbol| {
644-
cx.tcx.is_diagnostic_item(symbol, adt.did()) || Some(adt.did()) == cx.tcx.lang_items().string()
645-
});
643+
return Some(adt.did()) == cx.tcx.lang_items().string()
644+
|| std_types_symbols
645+
.iter()
646+
.any(|&symbol| cx.tcx.is_diagnostic_item(symbol, adt.did()));
646647
}
647648
false
648649
}

0 commit comments

Comments
 (0)