# no-redundant-closure-call

Disallow parameterless lambdas called where they are defined

Calling a parameterless lambda at its definition adds a callable boundary around one immediate computation.
Instead, you SHOULD evaluate the lambda body directly.

- Category: style
- Level: warning
- Fix: automatic
- Scope: module

## Reported

```ds title="main.ds"
function answer(): int32 {
    return (() => 42)();
}
```

## Accepted

```ds title="main.ds"
function answer(): int32 {
    return 42;
}
```

## Prior art

- [Clippy · redundant_closure_call](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call)

[language/linter/src/rules/style/no_redundant_closure_call.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/no_redundant_closure_call.rs#L8)
