Skip to content

Unnecessary macro expansion in unused_parens lint #55109

Closed
@Aaron1011

Description

@Aaron1011

This code snippet (playground)

fn main() {
    let _ = (format!("Test"));
}

results in the following lint output:

warning: unnecessary parentheses around assigned value
 --> src/main.rs:2:13
  |
2 |     let _ = (format!("Test"));
  |             ^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_parens)] on by default
help: remove these parentheses
  |
2 |     let _ = ::fmt::format(::std::fmt::Arguments::new_v1(&["Test"],
3 |                                              &match () { () => [], }));
  |

    Finished dev [unoptimized + debuginfo] target(s) in 0.56s
     Running `target/debug/playground`

The help: remove these parentheses should contain the literal string format!, not the expanded macro that it repreesnts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions