@@ -714,7 +714,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
714714 _ => None ,
715715 } ;
716716
717- let Some ( borrow_level) = borrow_level else { return false ; } ;
717+ let Some ( borrow_level) = borrow_level else {
718+ return false ;
719+ } ;
718720 let sugg = move_sites
719721 . iter ( )
720722 . map ( |move_site| {
@@ -763,7 +765,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
763765 . typeck_root_def_id ( self . mir_def_id ( ) . to_def_id ( ) )
764766 . as_local ( )
765767 . and_then ( |def_id| tcx. hir ( ) . get_generics ( def_id) )
766- else { return ; } ;
768+ else {
769+ return ;
770+ } ;
767771 // Try to find predicates on *generic params* that would allow copying `ty`
768772 let ocx = ObligationCtxt :: new ( & self . infcx ) ;
769773 let copy_did = tcx. require_lang_item ( LangItem :: Copy , Some ( span) ) ;
@@ -1220,18 +1224,20 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12201224 return ;
12211225 } ;
12221226 let inner_param_uses = find_all_local_uses:: find ( self . body , inner_param. local ) ;
1223- let Some ( ( inner_call_loc, inner_call_term) ) = inner_param_uses. into_iter ( ) . find_map ( |loc| {
1224- let Either :: Right ( term) = self . body . stmt_at ( loc) else {
1225- debug ! ( "{:?} is a statement, so it can't be a call" , loc) ;
1226- return None ;
1227- } ;
1228- let TerminatorKind :: Call { args, .. } = & term. kind else {
1229- debug ! ( "not a call: {:?}" , term) ;
1230- return None ;
1231- } ;
1232- debug ! ( "checking call args for uses of inner_param: {:?}" , args) ;
1233- args. contains ( & Operand :: Move ( inner_param) ) . then_some ( ( loc, term) )
1234- } ) else {
1227+ let Some ( ( inner_call_loc, inner_call_term) ) =
1228+ inner_param_uses. into_iter ( ) . find_map ( |loc| {
1229+ let Either :: Right ( term) = self . body . stmt_at ( loc) else {
1230+ debug ! ( "{:?} is a statement, so it can't be a call" , loc) ;
1231+ return None ;
1232+ } ;
1233+ let TerminatorKind :: Call { args, .. } = & term. kind else {
1234+ debug ! ( "not a call: {:?}" , term) ;
1235+ return None ;
1236+ } ;
1237+ debug ! ( "checking call args for uses of inner_param: {:?}" , args) ;
1238+ args. contains ( & Operand :: Move ( inner_param) ) . then_some ( ( loc, term) )
1239+ } )
1240+ else {
12351241 debug ! ( "no uses of inner_param found as a by-move call arg" ) ;
12361242 return ;
12371243 } ;
@@ -1442,21 +1448,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14421448 }
14431449
14441450 // Get closure's arguments
1445- let ty:: Closure ( _, substs) = typeck_results. expr_ty ( closure_expr) . kind ( ) else { /* hir::Closure can be a generator too */ return } ;
1451+ let ty:: Closure ( _, substs) = typeck_results. expr_ty ( closure_expr) . kind ( ) else {
1452+ /* hir::Closure can be a generator too */
1453+ return ;
1454+ } ;
14461455 let sig = substs. as_closure ( ) . sig ( ) ;
14471456 let tupled_params =
14481457 tcx. erase_late_bound_regions ( sig. inputs ( ) . iter ( ) . next ( ) . unwrap ( ) . map_bound ( |& b| b) ) ;
14491458 let ty:: Tuple ( params) = tupled_params. kind ( ) else { return } ;
14501459
14511460 // Find the first argument with a matching type, get its name
1452- let Some ( ( _, this_name) ) = params
1453- . iter ( )
1454- . zip ( hir. body_param_names ( closure. body ) )
1455- . find ( |( param_ty, name) |{
1461+ let Some ( ( _, this_name) ) =
1462+ params. iter ( ) . zip ( hir. body_param_names ( closure. body ) ) . find ( |( param_ty, name) | {
14561463 // FIXME: also support deref for stuff like `Rc` arguments
14571464 param_ty. peel_refs ( ) == local_ty && name != & Ident :: empty ( )
14581465 } )
1459- else { return } ;
1466+ else {
1467+ return ;
1468+ } ;
14601469
14611470 let spans;
14621471 if let Some ( ( _path_expr, qpath) ) = finder. error_path
@@ -2899,7 +2908,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
28992908 {
29002909 let def_id = def_id. expect_local ( ) ;
29012910 for operand in operands {
2902- let ( Operand :: Copy ( assigned_from) | Operand :: Move ( assigned_from) ) = operand else {
2911+ let ( Operand :: Copy ( assigned_from) | Operand :: Move ( assigned_from) ) =
2912+ operand
2913+ else {
29032914 continue ;
29042915 } ;
29052916 debug ! (
@@ -2908,7 +2919,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
29082919 ) ;
29092920
29102921 // Find the local from the operand.
2911- let Some ( assigned_from_local) = assigned_from. local_or_deref_local ( ) else {
2922+ let Some ( assigned_from_local) =
2923+ assigned_from. local_or_deref_local ( )
2924+ else {
29122925 continue ;
29132926 } ;
29142927
@@ -2961,7 +2974,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
29612974 ) ;
29622975
29632976 // Find the local from the rvalue.
2964- let Some ( assigned_from_local) = assigned_from. local_or_deref_local ( ) else { continue } ;
2977+ let Some ( assigned_from_local) = assigned_from. local_or_deref_local ( ) else {
2978+ continue ;
2979+ } ;
29652980 debug ! (
29662981 "annotate_argument_and_return_for_borrow: \
29672982 assigned_from_local={:?}",
@@ -3009,7 +3024,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
30093024 assigned_to, args
30103025 ) ;
30113026 for operand in args {
3012- let ( Operand :: Copy ( assigned_from) | Operand :: Move ( assigned_from) ) = operand else {
3027+ let ( Operand :: Copy ( assigned_from) | Operand :: Move ( assigned_from) ) = operand
3028+ else {
30133029 continue ;
30143030 } ;
30153031 debug ! (
0 commit comments