Skip to content

Commit

Permalink
Rollup merge of rust-lang#92799 - rust-lang:followup-from-92533, r=Aa…
Browse files Browse the repository at this point in the history
…ron1011

Remove some unnecessary uses of `FieldDef::ident`

Followup from rust-lang#92533.

cc ````@Aaron1011```` ````@petrochenkov````
  • Loading branch information
matthiaskrgr committed Jan 15, 2022
2 parents 91aaee4 + c84f2b2 commit dffb07a
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 @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dffb07a

Please sign in to comment.