@@ -354,9 +354,7 @@ where
354354 ty_to_bounds
355355 . into_iter ( )
356356 . flat_map ( |( ty, mut bounds) | {
357- if let Some ( data) = ty_to_fn. get ( & ty) {
358- let ( poly_trait, output) =
359- ( data. 0 . as_ref ( ) . unwrap ( ) . clone ( ) , data. 1 . as_ref ( ) . cloned ( ) . map ( Box :: new) ) ;
357+ if let Some ( ( Some ( ref poly_trait) , ref output) ) = ty_to_fn. get ( & ty) {
360358 let mut new_path = poly_trait. trait_ . clone ( ) ;
361359 let last_segment = new_path. segments . pop ( ) . expect ( "segments were empty" ) ;
362360
@@ -374,8 +372,9 @@ where
374372 GenericArgs :: Parenthesized { inputs, output } => ( inputs, output) ,
375373 } ;
376374
375+ let output = output. as_ref ( ) . cloned ( ) . map ( Box :: new) ;
377376 if old_output. is_some ( ) && old_output != output {
378- panic ! ( "Output mismatch for {:?} {:?} {:?}" , ty, old_output, data . 1 ) ;
377+ panic ! ( "Output mismatch for {:?} {:?} {:?}" , ty, old_output, output ) ;
379378 }
380379
381380 let new_params = GenericArgs :: Parenthesized { inputs : old_input, output } ;
@@ -385,7 +384,10 @@ where
385384 . push ( PathSegment { name : last_segment. name , args : new_params } ) ;
386385
387386 bounds. insert ( GenericBound :: TraitBound (
388- PolyTrait { trait_ : new_path, generic_params : poly_trait. generic_params } ,
387+ PolyTrait {
388+ trait_ : new_path,
389+ generic_params : poly_trait. generic_params . clone ( ) ,
390+ } ,
389391 hir:: TraitBoundModifier :: None ,
390392 ) ) ;
391393 }
0 commit comments