@@ -50,11 +50,8 @@ fn expr_is_func_mutable(arg: &Expression) -> bool {
5050 }
5151}
5252
53- pub fn mutates ( expr : & CallExpression , data : & FunctionData ) -> Option < VimFuncMutability > {
54- match data {
55- // FunctionData::VimFunc { .. } => return None,
56- _ => { }
57- } ;
53+ pub fn mutates ( expr : & CallExpression , _data : & FunctionData ) -> Option < VimFuncMutability > {
54+ { } ;
5855
5956 // Check if any args can even be mutated
6057 // If there are none, then it doesn't matter if the function
@@ -162,7 +159,7 @@ impl VimFunc {
162159 // })
163160 // .collect::<Vec<_>>();
164161
165- generate_mutable_fn_call ( & name, & args, & replaced)
162+ generate_mutable_fn_call ( name, & args, & replaced)
166163 }
167164}
168165
@@ -230,8 +227,8 @@ impl Generate for Vec<Expression> {
230227pub fn generate ( call : & CallExpression , state : & mut State ) -> String {
231228 let func_data: FunctionData = call. into ( ) ;
232229
233- match mutates ( call, & func_data) {
234- Some ( mutability ) => match func_data {
230+ if let Some ( mutability ) = mutates ( call, & func_data) {
231+ match func_data {
235232 FunctionData :: ApiFunc { .. } => { }
236233 FunctionData :: GeneratedFunc { .. } => { }
237234 FunctionData :: VimFuncRef { .. } => todo ! ( ) ,
@@ -242,8 +239,7 @@ pub fn generate(call: &CallExpression, state: &mut State) -> String {
242239 // but at the same time, it's nice to just assume that functions
243240 // that are expressions are really just generated funcs
244241 FunctionData :: ExprFunc { .. } => { }
245- } ,
246- None => { }
242+ }
247243 } ;
248244
249245 match func_data {
294290}
295291
296292fn generate_mutable_fn_call ( name : & str , args : & str , replace : & str ) -> String {
297- return format ! ( "vim9.fn_mut('{name}', {{ {args} }}, {{ replace = {replace} }})" ) ;
293+ format ! ( "vim9.fn_mut('{name}', {{ {args} }}, {{ replace = {replace} }})" )
298294}
299295
300296pub fn generate_method ( method : & parser:: MethodCall , state : & mut State ) -> String {
@@ -320,7 +316,7 @@ pub fn generate_method(method: &parser::MethodCall, state: &mut State) -> String
320316 let name = func_data. name ( ) ;
321317 let args = call. args . gen ( state) ;
322318 let replace = mutability. returned . unwrap ( ) . to_string ( ) ;
323- return generate_mutable_fn_call ( & name, & args, & replace) ;
319+ return generate_mutable_fn_call ( name, & args, & replace) ;
324320 }
325321 }
326322 }
0 commit comments