Commit graph

10 commits

Author SHA1 Message Date
Thibaut Vandervelden
f743fec6b0 fix: false positive for option_env! in ifs
Clippy had a false positive for with `ifs_same_cond` when two
if-let expressions have an `option_env!` macro. The fix is similar to the
`env!` macro fix.

The following example had a clippy error:

```rust
if let Some(env1) = option_env!("ENV1") {
    // ...
} else if let Some(env2) = option_env!("ENV2") {
    // ...
}
```

See https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=01b85c61b56ddd900117fb247af04824

changelog: Fix [`ifs_same_cond`] false positive when using `option_env!` in if-let expressions.
2023-07-20 12:04:24 +02:00
Oli Scherer
5bd97ac17a Update tests 2023-06-26 14:13:07 +00:00
Centri3
26f50395ba Add needless_if lint 2023-06-10 06:51:03 -05:00
Samuel "Sam" Tardieu
e6646eb5fd needless_else: new lint to check for empty else clauses 2023-05-22 11:52:26 +02:00
J-ZhengLi
f4ccb06d69 extract is_interior_mutable_type from [mut_key] to clippy_utils::ty;
fix configuration of [`ifs_same_cond`];

add some style improvement for [`ifs_same_cond`];
2023-03-13 20:17:30 +08:00
J-ZhengLi
f0ae2b71ca make [ifs_same_cond] use ignore_interior_mutablility configuration 2023-03-13 20:13:56 +08:00
J-ZhengLi
8a9492aa03 enhance [ifs_same_cond] to lint same immutable method calls as well 2023-03-13 20:13:56 +08:00
Lukas Lueg
657b0da912 Add partialeq_to_none lint
Fixes #9275
2022-08-08 20:17:13 +02:00
James Wang
52408f5b7d
Add a new lint for comparison chains 2019-09-24 16:55:05 -05:00
Philipp Hansch
3b035373b2
UI test cleanup: Extract ifs_same_cond tests 2019-01-02 07:59:48 +01:00