# needless-borrow

Disallow direct borrows that are immediately dereferenced

Dereferencing a borrow created by the same expression returns the original value place.
Instead, you SHOULD use that value directly.

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

## Reported

```ds title="main.ds"
function identity(value: int32): int32 {
    return *&value;
}
```

## Accepted

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

## Prior art

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

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