Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jruderman opened this issue Oct 18, 2015 · 0 comments
Closed
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@jruderman
Copy link
Contributor

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.

@steveklabnik steveklabnik added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Oct 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

2 participants