mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-15 01:17:16 +00:00
Auto merge of #12372 - GuillaumeGomez:fix-nonminimal_bool-regression, r=flip1995
Fix `nonminimal_bool` lint regression Fixes #12371. Fixes #12369. cc `@RalfJung` The problem was an invalid condition. Shame on me... changelog: Fix `nonminimal_bool` lint regression
This commit is contained in:
commit
e450a27a20
2 changed files with 7 additions and 2 deletions
|
@ -148,8 +148,8 @@ fn check_inverted_bool_in_condition(
|
|||
right: &Expr<'_>,
|
||||
) {
|
||||
if expr_span.from_expansion()
|
||||
&& (!cx.typeck_results().node_types()[left.hir_id].is_bool()
|
||||
|| !cx.typeck_results().node_types()[right.hir_id].is_bool())
|
||||
|| !cx.typeck_results().node_types()[left.hir_id].is_bool()
|
||||
|| !cx.typeck_results().node_types()[right.hir_id].is_bool()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -173,3 +173,8 @@ fn issue_5794() {
|
|||
if !b == !c {} //~ ERROR: this boolean expression can be simplified
|
||||
if !b != !c {} //~ ERROR: this boolean expression can be simplified
|
||||
}
|
||||
|
||||
fn issue_12371(x: usize) -> bool {
|
||||
// Should not warn!
|
||||
!x != 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue