mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 21:42:44 +00:00
Rollup merge of #92799 - rust-lang:followup-from-92533, r=Aaron1011
Remove some unnecessary uses of `FieldDef::ident` Followup from #92533. cc ``@Aaron1011`` ``@petrochenkov``
This commit is contained in:
commit
3de7276689
@ -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 {
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user