@@ -55,8 +55,8 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
5555 let c_ty = self . infcx . canonicalize_query ( & self . param_env . and ( ty) , & mut orig_values) ;
5656 let span = self . cause . span ;
5757 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 ( ) {
6060 if let Ok ( InferOk { value, obligations } ) =
6161 self . infcx . instantiate_query_response_and_region_obligations (
6262 self . cause ,
@@ -72,8 +72,6 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
7272 } ;
7373 }
7474 }
75-
76- _ => { /* fallthrough to error-handling code below */ }
7775 }
7876
7977 // Errors and ambiuity in dropck occur in two cases:
@@ -82,10 +80,11 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> {
8280 // Either of these should have created an error before.
8381 tcx. sess
8482 . delay_span_bug ( span, "dtorck encountered internal error" ) ;
85- return InferOk {
83+
84+ InferOk {
8685 value : vec ! [ ] ,
8786 obligations : vec ! [ ] ,
88- } ;
87+ }
8988 }
9089}
9190
@@ -102,7 +101,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> {
102101 span : Span ,
103102 ty : Ty < ' tcx > ,
104103 ) {
105- for overflow_ty in self . overflows . iter ( ) . take ( 1 ) {
104+ if let Some ( overflow_ty) = self . overflows . iter ( ) . next ( ) {
106105 let mut err = struct_span_err ! (
107106 tcx. sess,
108107 span,
@@ -228,7 +227,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
228227
229228 // (T1..Tn) and closures have same properties as T1..Tn --
230229 // 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) ) ,
232231 ty:: Closure ( def_id, ref substs) => substs
233232 . upvar_tys ( def_id, tcx)
234233 . all ( |t| trivial_dropck_outlives ( tcx, t) ) ,
0 commit comments