Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(eta_reduction): inline and rename some bindings

+4 -8
+4 -8
lib/src/lints/eta_reduction.rs
··· 47 47 }; 48 48 49 49 let lambda_expr = Lambda::cast(node.clone())?; 50 - let arg_node = lambda_expr.arg()?; 51 - let arg = Ident::cast(arg_node)?; 52 - let body_node = lambda_expr.body()?; 53 - let body = Apply::cast(body_node)?; 54 - let value_node = body.value()?; 55 - let value = Ident::cast(value_node)?; 50 + let ident = Ident::cast(lambda_expr.arg()?)?; 51 + let body = Apply::cast(lambda_expr.body()?)?; 56 52 57 - if arg.as_str() != value.as_str() { 53 + if ident.as_str() != Ident::cast(body.value()?)?.as_str() { 58 54 return None; 59 55 } 60 56 61 57 let lambda_node = body.lambda()?; 62 58 63 - if mentions_ident(&arg, &lambda_node) { 59 + if mentions_ident(&ident, &lambda_node) { 64 60 return None; 65 61 } 66 62