@@ -449,7 +449,12 @@ mod decl {
449
449
locals. copy ( ) . into_ref ( vm)
450
450
}
451
451
452
- fn min_or_max ( mut args : FuncArgs , vm : & VirtualMachine , func_name : & str , op : PyComparisonOp ) -> PyResult {
452
+ fn min_or_max (
453
+ mut args : FuncArgs ,
454
+ vm : & VirtualMachine ,
455
+ func_name : & str ,
456
+ op : PyComparisonOp ,
457
+ ) -> PyResult {
453
458
let default = args. take_keyword ( "default" ) ;
454
459
let mut key_func = args. take_keyword ( "key" ) ;
455
460
@@ -460,9 +465,10 @@ mod decl {
460
465
let candidates = match args. args . len ( ) . cmp ( & 1 ) {
461
466
std:: cmp:: Ordering :: Greater => {
462
467
if default. is_some ( ) {
463
- return Err ( vm. new_type_error (
464
- format ! ( "Cannot specify a default for {} with multiple positional arguments" , func_name) ,
465
- ) ) ;
468
+ return Err ( vm. new_type_error ( format ! (
469
+ "Cannot specify a default for {} with multiple positional arguments" ,
470
+ func_name
471
+ ) ) ) ;
466
472
}
467
473
args. args
468
474
}
@@ -477,8 +483,9 @@ mod decl {
477
483
let mut x = match candidates_iter. next ( ) {
478
484
Some ( x) => x,
479
485
None => {
480
- return default
481
- . ok_or_else ( || vm. new_value_error ( format ! ( "{} arg is an empty sequence" , func_name) ) )
486
+ return default. ok_or_else ( || {
487
+ vm. new_value_error ( format ! ( "{} arg is an empty sequence" , func_name) )
488
+ } )
482
489
}
483
490
} ;
484
491
@@ -503,7 +510,6 @@ mod decl {
503
510
Ok ( x)
504
511
}
505
512
506
-
507
513
#[ pyfunction]
508
514
fn max ( mut args : FuncArgs , vm : & VirtualMachine ) -> PyResult {
509
515
min_or_max ( args, vm, "max()" , PyComparisonOp :: Gt )
0 commit comments