Skip to content

Commit b91a6fc

Browse files
Replace Iterator::find calls with Iterator::any when better
1 parent 4ab8aa3 commit b91a6fc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,16 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
8484
let ty_res = ty_res.map_id(|_| panic!("unexpected node_id"));
8585
match ty_res {
8686
Res::Def(DefKind::Enum, did) => {
87-
let item = cx.tcx.inherent_impls(did)
88-
.iter()
89-
.flat_map(|imp| cx.tcx.associated_items(*imp))
90-
.find(|item| item.ident.name == variant_name);
91-
if item.is_some() {
87+
if cx.tcx.inherent_impls(did)
88+
.iter()
89+
.flat_map(|imp| cx.tcx.associated_items(*imp))
90+
.any(|item| item.ident.name == variant_name) {
9291
return Err(());
9392
}
9493
match cx.tcx.type_of(did).kind {
9594
ty::Adt(def, _) if def.is_enum() => {
9695
if def.all_fields()
97-
.find(|item| item.ident.name == variant_field_name).is_some() {
96+
.any(|item| item.ident.name == variant_field_name) {
9897
Ok((ty_res,
9998
Some(format!("variant.{}.field.{}",
10099
variant_name, variant_field_name))))

0 commit comments

Comments
 (0)