@@ -354,9 +354,7 @@ where
354
354
ty_to_bounds
355
355
. into_iter ( )
356
356
. 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) {
360
358
let mut new_path = poly_trait. trait_ . clone ( ) ;
361
359
let last_segment = new_path. segments . pop ( ) . expect ( "segments were empty" ) ;
362
360
@@ -374,8 +372,9 @@ where
374
372
GenericArgs :: Parenthesized { inputs, output } => ( inputs, output) ,
375
373
} ;
376
374
375
+ let output = output. as_ref ( ) . cloned ( ) . map ( Box :: new) ;
377
376
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 ) ;
379
378
}
380
379
381
380
let new_params = GenericArgs :: Parenthesized { inputs : old_input, output } ;
@@ -385,7 +384,10 @@ where
385
384
. push ( PathSegment { name : last_segment. name , args : new_params } ) ;
386
385
387
386
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
+ } ,
389
391
hir:: TraitBoundModifier :: None ,
390
392
) ) ;
391
393
}
0 commit comments