Skip to content

Commit

Permalink
Rollup merge of #92799 - rust-lang:followup-from-92533, r=Aaron1011
Browse files Browse the repository at this point in the history
Remove some unnecessary uses of `FieldDef::ident`

Followup from #92533.

cc ``@Aaron1011`` ``@petrochenkov``
  • Loading branch information
matthiaskrgr authored Jan 17, 2022
2 parents 869b7bc + c84f2b2 commit 3de7276
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,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 {
Expand Down Expand Up @@ -806,11 +805,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
Expand Down

0 comments on commit 3de7276

Please sign in to comment.