RS.CLIPPY.NEEDLESS_PARENS_ON_RANGE_LITERALS

Needless parenthesis on range literals can be removed

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: needless_parens_on_range_literals. Copyright ©2025 The Rust Team. All rights reserved.

What it does

The lint checks for parenthesis on literals in range statements that are superfluous.

Why is this bad?

Having superfluous parenthesis makes the code less readable overhead when reading.

Example

for i in (0)..10 {
  println!("{i}");
}

Use instead:

for i in 0..10 {
  println!("{i}");
}