1
Fork 0

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:
Guillaume Gomez 2021-06-07 01:06:50 +02:00 committed by GitHub
commit b71bc91192
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -711,15 +711,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,
} }