#17475·rust-clippy

double_parens: consider one diagnostic instead of one per pair?

Author: matthiaskrgrCreated Jul 30, 2026Updated Sep 18, 2026
LabelsC-enhancementD-confusing

Description

rust
#![allow(unused_parens)]
#![allow(non_upper_case_globals)]
#![allow(dead_code)]
#![cfg_attr(rustfmt, rustfmt::skip)]
static a: isize = ((((1))));

pub fn main() {}

clippy will print

warning: unnecessary parentheses
 --> a.rs:5:19
  |
5 | static a: isize = ((((1))));
  |                   ^^^^^^^^^ help: remove them: `(((1)))`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
  = note: `#[warn(clippy::double_parens)]` on by default

warning: unnecessary parentheses
 --> a.rs:5:20
  |
5 | static a: isize = ((((1))));
  |                    ^^^^^^^ help: remove them: `((1))`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_parens

warning: unnecessary parentheses
 --> a.rs:5:21
  |
5 | static a: isize = ((((1))));
  |                     ^^^^^ help: remove them: `(1)`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_parens

warning: 3 warnings emitted

which seems a bit over the top, can clippy figure out that we can reduce ((((1)))) to (1) in one go?

warning: unnecessary parentheses
 --> a.rs:5:19
  |
5 | static a: isize = ((((1))));
  |                   ^^^^^^^^^ help: remove them: `(1)`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
  = note: `#[warn(clippy::double_parens)]` on by default

Version

rustc 1.99.0-nightly (1a833e165 2026-07-29)
binary: rustc
commit-hash: 1a833e16546c2eb012758ddd499964fd8afee29e
commit-date: 2026-07-29
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

Additional Labels

No response