# no-identity-operation

Disallow arithmetic with an operand that cannot change the result

An integral identity operation such as `value + 0` returns the other operand unchanged.
Instead, you SHOULD remove the operation.

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

## Reported

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

## Accepted

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

## Prior art

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

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