Auto merge of #9457 - kraktus:nonminimal_bool, r=Manishearth
Do not expand macro in `nonminimal_bool` suggestions fix https://github.com/rust-lang/rust-clippy/issues/9428 changelog: Do not expand macros in [`nonminimal_bool`] suggestions
This commit is contained in:
commit
c8c2a234b3
@ -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…
x
Reference in New Issue
Block a user