Skip to content

Unnecessary parentheses warning is printed twice #88256

Closed
@jDomantas

Description

@jDomantas

This code:

pub fn repro() {
    if let Some(_a) = foo() {
        let _b = (foo());
    }
}

fn foo() -> Option<i32> { None }

Gives unnecessary parentheses warning twice:

warning: unnecessary parentheses around assigned value
 --> interpreter\src\lib.rs:3:18
  |
3 |         let _b = (foo());
  |                  ^^^^^^^ help: remove these parentheses
  |
  = note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around assigned value
 --> interpreter\src\lib.rs:3:18
  |
3 |         let _b = (foo());
  |                  ^^^^^^^ help: remove these parentheses

warning: 2 warnings emitted

Reproduced with stable 1.54.0 and nightly 2021-08-22 af14075 on playground.

Playground link

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions