-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 have
Description
Summary
The double_parens lint triggers when a macro that returns a parenthesized expression is wrapped in parentheses.
Presumably, this is not the "double parentheses" that the lint is trying to prevent, since there are no textual double parentheses ((( and )) being literally in the source code, ignoring spaces).
Lint Name
double_parens
Reproducer
I tried this code:
macro_rules! foo {
() => {(100)}
}
fn main(){
(foo!());
}I saw this happen:
the double_parens lint was triggered:
warning: consider removing unnecessary double parentheses
--> src/main.rs:6:5
|
6 | (foo!());
| ^^^^^^^^
|
= note: `#[warn(clippy::double_parens)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
I expected to see this happen:
The code compiles without triggering that specific lint.
Version
rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: i686-unknown-linux-gnu
release: 1.61.0
LLVM version: 14.0.0
Additional Labels
No response
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 have