- match ty.kind() {
- ty::Opaque(..) => ControlFlow::Break(ty),
- // Consider opaque types within projections FFI-safe if they do not normalize
- // to more opaque types.
- ty::Projection(..) => {
- let ty = self.cx.tcx.normalize_erasing_regions(self.cx.param_env, ty);
-
- // If `ty` is an opaque type directly then `super_visit_with` won't invoke
- // this function again.
- if ty.has_opaque_types() {
- self.visit_ty(ty)
- } else {
- ControlFlow::CONTINUE
- }
- }
- _ => ty.super_visit_with(self),
+ if !ty.has_opaque_types() {
+ return ControlFlow::CONTINUE;
+ }
+
+ if let ty::Opaque(..) = ty.kind() {
+ ControlFlow::Break(ty)
+ } else {
+ ty.super_visit_with(self)