Skip to content

Missing "unnecessary parentheses" warning #46137

Closed
@leonardo-m

Description

@leonardo-m

This program compiles without warnings:

fn main() {
    use std::ops::Range;
    fn foo(r1: Range<u32>, r2: Range<u32>) {
        for _ in r1 {}
        for _ in r2 {}
    }
    foo((0 .. 10), (0 .. 10)); // ***
    foo(0 .. 10, 0 .. 10);
}

I expected a "unnecessary parentheses" warning on the first call to foo() because #[warn(unused_parens)] is on by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions