Skip to content

Please warn on "value passed in is never used" (for mutable arguments) #29136

Closed
@jruderman

Description

@jruderman
fn x() -> i32
{
    let mut a : i32 = 4;
    a = 5;
    a
}

warning: value assigned to a is never read, #[warn(unused_assignments)] on by default

fn y(mut a: i32) -> i32
{
    a = 3;
    a
}

Does not warn, even though it has pretty much the same problem. In this case, the value passed in is never used.

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