mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
Rollup merge of #85912 - LingMan:iter_any, r=nagisa
Use `Iterator::any` and `filter_map` instead of open-coding them ``@rustbot`` modify labels +C-cleanup +T-compiler
This commit is contained in:
commit
b71bc91192
@ -711,15 +711,10 @@ fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: CItemKi
|
||||
return false;
|
||||
}
|
||||
|
||||
for variant in &def.variants {
|
||||
if let Some(field) = transparent_newtype_field(cx.tcx, variant) {
|
||||
if ty_is_known_nonnull(cx, field.ty(tcx, substs), mode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
def.variants
|
||||
.iter()
|
||||
.filter_map(|variant| transparent_newtype_field(cx.tcx, variant))
|
||||
.any(|field| ty_is_known_nonnull(cx, field.ty(tcx, substs), mode))
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user