collapse some nested blocks

This commit is contained in:
Daniel Eades 2023-01-10 20:40:08 +00:00
parent 95fc3ba41c
commit d218b237fd
10 changed files with 62 additions and 78 deletions

View file

@ -251,17 +251,14 @@ fn layout_of_unit(cx: &LayoutCx<'_>, dl: &TargetDataLayout) -> Result<Layout, La
fn struct_tail_erasing_lifetimes(db: &dyn HirDatabase, pointee: Ty) -> Ty {
match pointee.kind(Interner) {
TyKind::Adt(AdtId(adt), subst) => match adt {
&hir_def::AdtId::StructId(i) => {
let data = db.struct_data(i);
let mut it = data.variant_data.fields().iter().rev();
match it.next() {
Some((f, _)) => field_ty(db, i.into(), f, subst),
None => pointee,
}
TyKind::Adt(AdtId(hir_def::AdtId::StructId(i)), subst) => {
let data = db.struct_data(*i);
let mut it = data.variant_data.fields().iter().rev();
match it.next() {
Some((f, _)) => field_ty(db, (*i).into(), f, subst),
None => pointee,
}
_ => pointee,
},
}
_ => pointee,
}
}