@@ -8436,30 +8436,24 @@ impl<'a> UnwrapAnonymousFunction<'a> {
8436
8436
// the args we pass to the called function, so we need to collect the
8437
8437
// names used in both lists and check they're equal.
8438
8438
8439
- let mut outer_argument_names = Vec :: with_capacity ( arguments. len ( ) ) ;
8440
- for a in arguments {
8441
- match & a. names {
8442
- ArgNames :: Named { name, .. } => outer_argument_names. push ( name) ,
8443
- // We can bail out early if any arguments are discarded, since
8444
- // they couldn't match those actually used.
8445
- ArgNames :: Discard { .. } => return ,
8446
- // Anonymous functions can't have labelled arguments.
8447
- ArgNames :: NamedLabelled { .. } => unreachable ! ( ) ,
8448
- ArgNames :: LabelledDiscard { .. } => unreachable ! ( ) ,
8449
- }
8450
- }
8439
+ let outer_argument_names = arguments. iter ( ) . map ( |a| match & a. names {
8440
+ ArgNames :: Named { name, .. } => Some ( name) ,
8441
+ // We can bail out early if any arguments are discarded, since
8442
+ // they couldn't match those actually used.
8443
+ ArgNames :: Discard { .. } => None ,
8444
+ // Anonymous functions can't have labelled arguments.
8445
+ ArgNames :: NamedLabelled { .. } => unreachable ! ( ) ,
8446
+ ArgNames :: LabelledDiscard { .. } => unreachable ! ( ) ,
8447
+ } ) ;
8451
8448
8452
- let mut inner_argument_names = Vec :: with_capacity ( arguments. len ( ) ) ;
8453
- for a in call_arguments {
8454
- match & a. value {
8455
- TypedExpr :: Var { name, .. } => inner_argument_names. push ( name) ,
8456
- // We can bail out early if any of these aren't variables, since
8457
- // they couldn't match the inputs.
8458
- _ => return ,
8459
- }
8460
- }
8449
+ let inner_argument_names = call_arguments. iter ( ) . map ( |a| match & a. value {
8450
+ TypedExpr :: Var { name, .. } => Some ( name) ,
8451
+ // We can bail out early if any of these aren't variables, since
8452
+ // they couldn't match the inputs.
8453
+ _ => None ,
8454
+ } ) ;
8461
8455
8462
- if inner_argument_names != outer_argument_names {
8456
+ if !inner_argument_names . eq ( outer_argument_names) {
8463
8457
return ;
8464
8458
}
8465
8459
0 commit comments