Separate out a hir::Impl struct

This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.
This commit is contained in:
Joshua Nelson 2020-11-22 17:46:21 -05:00
parent fd34606ddf
commit a8ff647deb
61 changed files with 258 additions and 246 deletions

View file

@ -318,7 +318,7 @@ impl<'tcx> SaveContext<'tcx> {
attributes: lower_attributes(item.attrs.to_vec(), self),
}))
}
hir::ItemKind::Impl { ref of_trait, ref self_ty, ref items, .. } => {
hir::ItemKind::Impl(hir::Impl { ref of_trait, ref self_ty, ref items, .. }) => {
if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = self_ty.kind {
// Common case impl for a struct or something basic.
if generated_code(path.span) {
@ -410,7 +410,7 @@ impl<'tcx> SaveContext<'tcx> {
match self.tcx.impl_of_method(def_id) {
Some(impl_id) => match self.tcx.hir().get_if_local(impl_id) {
Some(Node::Item(item)) => match item.kind {
hir::ItemKind::Impl { ref self_ty, .. } => {
hir::ItemKind::Impl(hir::Impl { ref self_ty, .. }) => {
let hir = self.tcx.hir();
let mut qualname = String::from("<");