Use Item::expect_* and ImplItem::expect_* more
This commit is contained in:
@@ -74,10 +74,9 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
|
||||
|
||||
debug!("visit_implementation_of_copy: self_type={:?} (free)", self_type);
|
||||
|
||||
let span = match tcx.hir().expect_item(impl_did).kind {
|
||||
ItemKind::Impl(hir::Impl { polarity: hir::ImplPolarity::Negative(_), .. }) => return,
|
||||
ItemKind::Impl(impl_) => impl_.self_ty.span,
|
||||
_ => bug!("expected Copy impl item"),
|
||||
let span = match tcx.hir().expect_item(impl_did).expect_impl() {
|
||||
hir::Impl { polarity: hir::ImplPolarity::Negative(_), .. } => return,
|
||||
hir::Impl { self_ty, .. } => self_ty.span,
|
||||
};
|
||||
|
||||
let cause = traits::ObligationCause::misc(span, impl_did);
|
||||
|
||||
Reference in New Issue
Block a user