-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Description
Summary
equatable_if_let
is triggered from inside an external macro.
Lint Name
equatable_if_let
Reproducer
I tried this code:
macro_rules! concat_assert {
($condition:expr) => {
if let false = $condition {
}
};
}
const _: () = {
concat_assert!(true);
};
I saw this happen:
warning: this pattern matching can be expressed using equality
--> src/render/shader/shader_manual.rs:32:12
|
30 | / macro_rules! test {
31 | | ($condition:expr) => {
32 | | if let false = $condition {
| | ^^^ help: try: `true == false`
33 | |
34 | | }
35 | | };
36 | | }
| |_- in this expansion of `test!`
...
39 | test!(true);
| ----------- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#equatable_if_let
I expected to see this happen:
No warning. Obviously this example code has to be split up into different crates, personally I'm fine with this lint triggering for internal macros.
Version
rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-unknown-linux-gnu
release: 1.61.0
LLVM version: 14.0.0
Additional Labels
@rustbot label T-macros
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion