@@ -144,8 +144,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
144144 fn unify ( & self , a : Ty < ' tcx > , b : Ty < ' tcx > ) -> InferResult < ' tcx , Ty < ' tcx > > {
145145 self . commit_if_ok ( |_| {
146146 if self . use_lub {
147- self . at ( & self . cause , self . fcx . param_env )
148- . lub ( b, a)
147+ self . at ( & self . cause , self . fcx . param_env ) . lub ( b, a)
149148 } else {
150149 self . at ( & self . cause , self . fcx . param_env )
151150 . sup ( b, a)
@@ -256,8 +255,8 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
256255 b : Ty < ' tcx > ,
257256 r_b : ty:: Region < ' tcx > ,
258257 mt_b : TypeAndMut < ' tcx > )
259- -> CoerceResult < ' tcx > {
260-
258+ -> CoerceResult < ' tcx >
259+ {
261260 debug ! ( "coerce_borrowed_pointer(a={:?}, b={:?})" , a, b) ;
262261
263262 // If we have a parameter of type `&M T_a` and the value
@@ -591,9 +590,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
591590 }
592591
593592 Ok ( Some ( vtable) ) => {
594- for obligation in vtable. nested_obligations ( ) {
595- queue. push_back ( obligation) ;
596- }
593+ queue. extend ( vtable. nested_obligations ( ) )
597594 }
598595 }
599596 }
@@ -620,12 +617,11 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
620617 G : FnOnce ( Ty < ' tcx > ) -> Vec < Adjustment < ' tcx > >
621618 {
622619 if let ty:: FnPtr ( fn_ty_b) = b. sty {
623- match ( fn_ty_a. unsafety ( ) , fn_ty_b. unsafety ( ) ) {
624- ( hir:: Unsafety :: Normal , hir:: Unsafety :: Unsafe ) => {
625- let unsafe_a = self . tcx . safe_to_unsafe_fn_ty ( fn_ty_a) ;
626- return self . unify_and ( unsafe_a, b, to_unsafe) ;
627- }
628- _ => { }
620+ if let ( hir:: Unsafety :: Normal , hir:: Unsafety :: Unsafe )
621+ = ( fn_ty_a. unsafety ( ) , fn_ty_b. unsafety ( ) )
622+ {
623+ let unsafe_a = self . tcx . safe_to_unsafe_fn_ty ( fn_ty_a) ;
624+ return self . unify_and ( unsafe_a, b, to_unsafe) ;
629625 }
630626 }
631627 self . unify_and ( a, b, normal)
@@ -653,7 +649,6 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
653649 -> CoerceResult < ' tcx > {
654650 //! Attempts to coerce from the type of a Rust function item
655651 //! into a closure or a `proc`.
656- //!
657652
658653 let b = self . shallow_resolve ( b) ;
659654 debug ! ( "coerce_from_fn_item(a={:?}, b={:?})" , a, b) ;
@@ -724,9 +719,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
724719 let ( is_ref, mt_a) = match a. sty {
725720 ty:: Ref ( _, ty, mutbl) => ( true , ty:: TypeAndMut { ty, mutbl } ) ,
726721 ty:: RawPtr ( mt) => ( false , mt) ,
727- _ => {
728- return self . unify_and ( a, b, identity) ;
729- }
722+ _ => return self . unify_and ( a, b, identity)
730723 } ;
731724
732725 // Check that the types which they point at are compatible.
@@ -896,10 +889,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
896889 } ;
897890
898891 if !noop {
899- return self . commit_if_ok ( |_| {
892+ return self . commit_if_ok ( |_|
900893 self . at ( cause, self . param_env )
901894 . lub ( prev_ty, new_ty)
902- } ) . map ( |ok| self . register_infer_ok_obligations ( ok) ) ;
895+ ) . map ( |ok| self . register_infer_ok_obligations ( ok) ) ;
903896 }
904897 }
905898
@@ -909,10 +902,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
909902 if let Some ( e) = first_error {
910903 Err ( e)
911904 } else {
912- self . commit_if_ok ( |_| {
905+ self . commit_if_ok ( |_|
913906 self . at ( cause, self . param_env )
914907 . lub ( prev_ty, new_ty)
915- } ) . map ( |ok| self . register_infer_ok_obligations ( ok) )
908+ ) . map ( |ok| self . register_infer_ok_obligations ( ok) )
916909 }
917910 }
918911 Ok ( ok) => {
@@ -1005,7 +998,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
1005998 /// needlessly cloning the slice.
1006999 pub fn with_coercion_sites ( expected_ty : Ty < ' tcx > ,
10071000 coercion_sites : & ' exprs [ E ] )
1008- -> Self {
1001+ -> Self {
10091002 Self :: make ( expected_ty, Expressions :: UpFront ( coercion_sites) )
10101003 }
10111004
0 commit comments