@@ -7739,30 +7739,24 @@ impl<'a> UnwrapAnonymousFunction<'a> {
7739
7739
// the args we pass to the called function, so we need to collect the
7740
7740
// names used in both lists and check they're equal.
7741
7741
7742
- let mut outer_argument_names = Vec :: with_capacity ( arguments. len ( ) ) ;
7743
- for a in arguments {
7744
- match & a. names {
7745
- ArgNames :: Named { name, .. } => outer_argument_names. push ( name) ,
7746
- // We can bail out early if any arguments are discarded, since
7747
- // they couldn't match those actually used.
7748
- ArgNames :: Discard { .. } => return ,
7749
- // Anonymous functions can't have labelled arguments.
7750
- ArgNames :: NamedLabelled { .. } => unreachable ! ( ) ,
7751
- ArgNames :: LabelledDiscard { .. } => unreachable ! ( ) ,
7752
- }
7753
- }
7742
+ let outer_argument_names = arguments. iter ( ) . map ( |a| match & a. names {
7743
+ ArgNames :: Named { name, .. } => Some ( name) ,
7744
+ // We can bail out early if any arguments are discarded, since
7745
+ // they couldn't match those actually used.
7746
+ ArgNames :: Discard { .. } => None ,
7747
+ // Anonymous functions can't have labelled arguments.
7748
+ ArgNames :: NamedLabelled { .. } => unreachable ! ( ) ,
7749
+ ArgNames :: LabelledDiscard { .. } => unreachable ! ( ) ,
7750
+ } ) ;
7754
7751
7755
- let mut inner_argument_names = Vec :: with_capacity ( arguments. len ( ) ) ;
7756
- for a in call_arguments {
7757
- match & a. value {
7758
- TypedExpr :: Var { name, .. } => inner_argument_names. push ( name) ,
7759
- // We can bail out early if any of these aren't variables, since
7760
- // they couldn't match the inputs.
7761
- _ => return ,
7762
- }
7763
- }
7752
+ let inner_argument_names = call_arguments. iter ( ) . map ( |a| match & a. value {
7753
+ TypedExpr :: Var { name, .. } => Some ( name) ,
7754
+ // We can bail out early if any of these aren't variables, since
7755
+ // they couldn't match the inputs.
7756
+ _ => None ,
7757
+ } ) ;
7764
7758
7765
- if inner_argument_names != outer_argument_names {
7759
+ if !inner_argument_names . eq ( outer_argument_names) {
7766
7760
return ;
7767
7761
}
7768
7762
0 commit comments