Auto merge of #10845 - disco07:master, r=giraffate

nonminimal_bool fix double not

fix issue https://github.com/rust-lang/rust-clippy/issues/10836

changelog: Fix [`nonminimal_bool`] false positive when `!!x`, `x` isn't boolean and implements `Not`
This commit is contained in:
bors 2023-05-31 13:36:09 +00:00
commit e85869578d
2 changed files with 18 additions and 1 deletions

View file

@ -110,3 +110,17 @@ fn issue_10435() {
println!("{}", line!());
}
}
fn issue10836() {
struct Foo(bool);
impl std::ops::Not for Foo {
type Output = bool;
fn not(self) -> Self::Output {
!self.0
}
}
// Should not lint
let _: bool = !!Foo(true);
}