File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -240,20 +240,16 @@ impl CompleteState {
240240                if  n < k { 
241241                    return  Some ( 0 ) ; 
242242                } 
243-                 ( n - k + 1 ..=n) . fold ( Some ( 1 ) ,  |acc,  i| { 
244-                     acc. and_then ( |acc| acc. checked_mul ( i) ) 
245-                 } ) 
243+                 ( n - k + 1 ..=n) . try_fold ( 1usize ,  |acc,  i| acc. checked_mul ( i) ) 
246244            } 
247245            CompleteState :: Ongoing  {  ref  indices,  ref  cycles }  => { 
248-                 let  mut  count:  usize  = 0 ; 
249- 
250-                 for  ( i,  & c)  in  cycles. iter ( ) . enumerate ( )  { 
251-                     let  radix = indices. len ( )  - i; 
252-                     count = count. checked_mul ( radix) 
253-                         . and_then ( |count| count. checked_add ( c) ) ?; 
254-                 } 
255- 
256-                 Some ( count) 
246+                 cycles
247+                     . iter ( ) 
248+                     . enumerate ( ) 
249+                     . try_fold ( 0usize ,  |acc,  ( i,  & c) | { 
250+                         acc. checked_mul ( indices. len ( )  - i) 
251+                             . and_then ( |count| count. checked_add ( c) ) 
252+                     } ) 
257253            } 
258254        } 
259255    } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments