DioxusLabs / DioxusLabs/dioxus
Add lints for hooks in conditional branches (`&&` + `||`)
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Feature Request
Follow-up for https://github.com/DioxusLabs/dioxus/pull/2902
We should add lints for hooks in conditional branches such as:
* `if` statements:
```rs
let some_value = false;
if some_value && use_signal(|| true)() {
println!("123");
}
```
* `match` statements:
```rs
let some_value = Some(false);
match x {
Some(b) if b && use_signal(|| true)() => { ... }
...
}
```
## Implement Suggestion
Add checks to https://github.com/DioxusLabs/dioxus/blob/main/packages/check/src/check.rs
We could ignore cases where literals (and maybe constants) are used if possible (e.g. `if true && use_hook(...)`), but clippy should hopefully prevent cases like that
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.