Skip to content

Liveness lints should consider statement attributes #30326

Closed
@mitaa

Description

@mitaa
#![feature(stmt_expr_attributes)]

fn main() {
    #[allow(unused_variables)]
    let mut foo = 7;
    #[allow(unused_assignments)]
    foo = 42;
}
<anon>:5:9: 5:16 warning: variable `foo` is assigned to, but never used, #[warn(unused_variables)] on by default
<anon>:5     let mut foo = 7;
                 ^~~~~~~
<anon>:7:5: 7:8 warning: value assigned to `foo` is never read, #[warn(unused_assignments)] on by default
<anon>:7     foo = 42;
             ^~~

I would expect to see no warnings.

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