mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Do not expand macro in nonminimal_bool
suggestions
This commit is contained in:
parent
da8afc9ecf
commit
d50f366612
3 changed files with 14 additions and 2 deletions
|
@ -237,7 +237,7 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&Term(n) => {
|
&Term(n) => {
|
||||||
let snip = snippet_opt(self.cx, self.terminals[n as usize].span)?;
|
let snip = snippet_opt(self.cx, self.terminals[n as usize].span.source_callsite())?;
|
||||||
self.output.push_str(&snip);
|
self.output.push_str(&snip);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,3 +57,9 @@ fn check_expect() {
|
||||||
#[expect(clippy::nonminimal_bool)]
|
#[expect(clippy::nonminimal_bool)]
|
||||||
let _ = !!a;
|
let _ = !!a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn issue9428() {
|
||||||
|
if matches!(true, true) && true {
|
||||||
|
println!("foo");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -107,5 +107,11 @@ LL | let _ = !(a == b || c == d);
|
||||||
LL | let _ = a != b && c != d;
|
LL | let _ = a != b && c != d;
|
||||||
| ~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: aborting due to 12 previous errors
|
error: this boolean expression can be simplified
|
||||||
|
--> $DIR/nonminimal_bool.rs:62:8
|
||||||
|
|
|
||||||
|
LL | if matches!(true, true) && true {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(true, true)`
|
||||||
|
|
||||||
|
error: aborting due to 13 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue