# no-erasing-operation

Disallow operations that erase their operand into a constant

An integral operation with an erasing operand produces a constant whenever the operation completes.
Instead, you SHOULD correct the operator or constant operand that caused the value to be discarded.

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

## Reported

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

## Accepted

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

## Prior art

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

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