summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2022-01-11 16:23:19 -0800
committerNoah Lev <camelidcamel@gmail.com>2022-01-11 17:03:45 -0800
commitc84f2b27d3a72526bce7ff89c7be741d2daef123 (patch)
treee776f575a8bb9f3d4afdc4ade6fb3f51ceb3dc1a
parent72e74d7b9cf1a7901650227e74650f1fcc797600 (diff)
downloadrust-followup-from-92533.tar.gz
Remove some unnecessary uses of `FieldDef::ident`followup-from-92533
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index af62232e792..fb055bb2244 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -398,8 +398,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
}
match tcx.type_of(did).kind() {
ty::Adt(def, _) if def.is_enum() => {
- if let Some(field) =
- def.all_fields().find(|f| f.ident(tcx).name == variant_field_name)
+ if let Some(field) = def.all_fields().find(|f| f.name == variant_field_name)
{
Ok((ty_res, Some(ItemFragment(FragmentKind::VariantField, field.did))))
} else {
@@ -770,11 +769,8 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
ty::Adt(def, _) if !def.is_enum() => def,
_ => return None,
};
- let field = def
- .non_enum_variant()
- .fields
- .iter()
- .find(|item| item.ident(tcx).name == item_name)?;
+ let field =
+ def.non_enum_variant().fields.iter().find(|item| item.name == item_name)?;
Some((root_res, ItemFragment(FragmentKind::StructField, field.did)))
}
Res::Def(DefKind::Trait, did) => tcx