# nonminimal-bool

Simplify boolean expressions with redundant or contradictory terms

Repeated, complementary, or absorbed terms make a boolean expression more complex without changing its value.
Instead, you SHOULD remove the redundant terms or use the resulting boolean constant.

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

## Reported

```ds title="main.ds"
function canRead(isOwner: boolean, isShared: boolean): boolean {
    return isOwner || (isOwner && isShared);
}
```

## Accepted

```ds title="main.ds"
function canRead(isOwner: boolean, isShared: boolean): boolean {
    return isOwner;
}
```

## Prior art

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

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