# no-useless-return

Disallow bare returns where the function already ends

A bare `return` on a path that already reaches the end of its function performs no additional control transfer.
Instead, you SHOULD remove the redundant statement and let the function complete normally.

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

## Reported

```ds title="main.ds"
function record(value: int32): void {
    value;
    return;
}
```

## Accepted

```ds title="main.ds"
function record(value: int32): void {
    value;
}
```

## Prior art

- [ESLint · no-useless-return](https://eslint.org/docs/latest/rules/no-useless-return)

[language/linter/src/rules/suspicious/no_useless_return.rs:6](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/suspicious/no_useless_return.rs#L6)
