# prefer-implicit-return

Prefer expression bodies for lambdas that only return one value

A lambda block containing only `return value` adds a statement around its result.
Instead, you SHOULD use `value` as the lambda body directly.

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

## Reported

```ds title="main.ds"
function double(values: int32[]): int32[] {
    return values.map((value) => {
        return value * 2;
    });
}
```

## Accepted

```ds title="main.ds"
function double(values: int32[]): int32[] {
    return values.map((value) => value * 2);
}
```

## Prior art

- [ESLint · arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style)

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