mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-14 04:56:49 +00:00
Remove some unnecessary uses of FieldDef::ident
This commit is contained in:
parent
72e74d7b9c
commit
c84f2b27d3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user