mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Use Iterator::any
and filter_map
instead of open-coding them
This commit is contained in:
parent
1160cf864f
commit
0933fbd05a
@ -712,15 +712,10 @@ fn ty_is_known_nonnull<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, mode: CItemKi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for variant in &def.variants {
|
def.variants
|
||||||
if let Some(field) = transparent_newtype_field(cx.tcx, variant) {
|
.iter()
|
||||||
if ty_is_known_nonnull(cx, field.ty(tcx, substs), mode) {
|
.filter_map(|variant| transparent_newtype_field(cx.tcx, variant))
|
||||||
return true;
|
.any(|field| ty_is_known_nonnull(cx, field.ty(tcx, substs), mode))
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user