-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions
Description
I tried this code:
#![warn(clippy::equatable_if_let)]
macro_rules! m1 {
(x) => { "abc" };
(y) => { "def" };
}
fn main() {
if let m1!(x) = "abc" {
println!("OK");
}
}I expected to see this happen: I would get recommendation if "abc" == m1!(x)
Instead, this happened:
warning: this pattern matching can be expressed using equality
--> src/main.rs:9:8
|
9 | if let m1!(x) = "abc" {
| ^^^^^^^^^^^^^^^^^^ help: try: `"abc" == "abc"`
|
The macro call is expanded. This code isn't equivalent depending on the macro.
Meta
Run on clippy master - 01ea06a
@rustbot label +L-suggestion
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions