We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Iterator::find
1 parent 1160cf8 commit 86562b4Copy full SHA for 86562b4
compiler/rustc_lint/src/types.rs
@@ -680,16 +680,11 @@ pub fn transparent_newtype_field<'a, 'tcx>(
680
variant: &'a ty::VariantDef,
681
) -> Option<&'a ty::FieldDef> {
682
let param_env = tcx.param_env(variant.def_id);
683
- for field in &variant.fields {
+ variant.fields.iter().find(|field| {
684
let field_ty = tcx.type_of(field.did);
685
let is_zst = tcx.layout_of(param_env.and(field_ty)).map_or(false, |layout| layout.is_zst());
686
-
687
- if !is_zst {
688
- return Some(field);
689
- }
690
691
692
- None
+ !is_zst
+ })
693
}
694
695
/// Is type known to be non-null?
0 commit comments