@@ -55,8 +55,8 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
55
55
let c_ty = self . infcx . canonicalize_query ( & self . param_env . and ( ty) , & mut orig_values) ;
56
56
let span = self . cause . span ;
57
57
debug ! ( "c_ty = {:?}" , c_ty) ;
58
- match & gcx. dropck_outlives ( c_ty) {
59
- Ok ( result ) if result. is_proven ( ) => {
58
+ if let Ok ( result ) = & gcx. dropck_outlives ( c_ty) {
59
+ if result. is_proven ( ) {
60
60
if let Ok ( InferOk { value, obligations } ) =
61
61
self . infcx . instantiate_query_response_and_region_obligations (
62
62
self . cause ,
@@ -72,8 +72,6 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
72
72
} ;
73
73
}
74
74
}
75
-
76
- _ => { /* fallthrough to error-handling code below */ }
77
75
}
78
76
79
77
// Errors and ambiuity in dropck occur in two cases:
@@ -82,10 +80,11 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
82
80
// Either of these should have created an error before.
83
81
tcx. sess
84
82
. delay_span_bug ( span, "dtorck encountered internal error" ) ;
85
- return InferOk {
83
+
84
+ InferOk {
86
85
value : vec ! [ ] ,
87
86
obligations : vec ! [ ] ,
88
- } ;
87
+ }
89
88
}
90
89
}
91
90
@@ -102,7 +101,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> {
102
101
span : Span ,
103
102
ty : Ty < ' tcx > ,
104
103
) {
105
- for overflow_ty in self . overflows . iter ( ) . take ( 1 ) {
104
+ if let Some ( overflow_ty) = self . overflows . iter ( ) . next ( ) {
106
105
let mut err = struct_span_err ! (
107
106
tcx. sess,
108
107
span,
@@ -228,7 +227,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
228
227
229
228
// (T1..Tn) and closures have same properties as T1..Tn --
230
229
// check if *any* of those are trivial.
231
- ty:: Tuple ( ref tys) => tys. iter ( ) . cloned ( ) . all ( |t| trivial_dropck_outlives ( tcx, t) ) ,
230
+ ty:: Tuple ( ref tys) => tys. iter ( ) . all ( |t| trivial_dropck_outlives ( tcx, t) ) ,
232
231
ty:: Closure ( def_id, ref substs) => substs
233
232
. upvar_tys ( def_id, tcx)
234
233
. all ( |t| trivial_dropck_outlives ( tcx, t) ) ,
0 commit comments