mirror of
https://github.com/nerdypepper/statix.git
synced 2024-10-04 01:08:05 +03:00
make eta_reduction less aggressive (#76)
Co-authored-by: Stephan Maka <stephan.maka@cyberus-technology.de>
This commit is contained in:
parent
3c7136a23f
commit
bcb3d10f2a
@ -15,4 +15,7 @@ in
|
||||
|
||||
# other non-free forms
|
||||
(map (f: {inherit f;}.double f.val) [ f ])
|
||||
|
||||
# don't reduce on more complex lambda bodies
|
||||
(map (x: builtins.div 3 x) xs)
|
||||
]
|
||||
|
@ -56,10 +56,13 @@ impl Rule for EtaReduction {
|
||||
if let Some(value_node) = body.value();
|
||||
if let Some(value) = Ident::cast(value_node);
|
||||
|
||||
if arg.as_str() == value.as_str() ;
|
||||
if arg.as_str() == value.as_str();
|
||||
|
||||
if let Some(lambda_node) = body.lambda();
|
||||
if !mentions_ident(&arg, &lambda_node);
|
||||
// lambda body should be no more than a single Ident to
|
||||
// retain code readability
|
||||
if let Some(_) = Ident::cast(lambda_node);
|
||||
|
||||
then {
|
||||
let at = node.text_range();
|
||||
|
Loading…
Reference in New Issue
Block a user