Skip to content

Commit a314631

Browse files
committed
avoid try_fold
1 parent 30780fb commit a314631

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/librustc_target/abi/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,13 +1159,16 @@ impl<'a, Ty> TyLayout<'a, Ty> {
11591159
// with any element type, so let us not (yet) complain about that.
11601160
// count == 0 || inner.field(cx, 0).to_result()?.might_permit_zero_init(cx)?
11611161
true,
1162-
FieldPlacement::Arbitrary { ref offsets, .. } =>
1162+
FieldPlacement::Arbitrary { ref offsets, .. } => {
11631163
// Check that all fields accept zero-init.
1164-
(0..offsets.len()).try_fold(true, |accu, idx|
1165-
Ok(accu &&
1166-
inner.field(cx, idx).to_result()?.might_permit_zero_init(cx)?
1167-
)
1168-
)?
1164+
for idx in 0..offsets.len() {
1165+
if !inner.field(cx, idx).to_result()?.might_permit_zero_init(cx)? {
1166+
return Ok(false);
1167+
}
1168+
}
1169+
// No bad field found, we are good.
1170+
true
1171+
}
11691172
}
11701173
}
11711174
};

0 commit comments

Comments
 (0)