Skip to content
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

Overly aggressive mut lint in match patterns #13866

Closed
seanmonstar opened this issue Apr 30, 2014 · 4 comments
Closed

Overly aggressive mut lint in match patterns #13866

seanmonstar opened this issue Apr 30, 2014 · 4 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@seanmonstar
Copy link
Contributor

fn main() {
    match (3u, 'd') {
        (mut x, c@'a'..'z') |
        (mut x, c@'A'..'Z') |
        (mut x, c@'0'..'9') => {
            x = 4u;
            println!("c: {} {}", c, x);
        }
        _ => {
            println!("fail");
        }
    }
}

Output:

Untitled.rs:4:10: 4:15 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
Untitled.rs:4         (mut x, c@'A'..'Z') |
                       ^~~~~
Untitled.rs:5:10: 5:15 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
Untitled.rs:5         (mut x, c@'0'..'9') => {
                       ^~~~~
c: d 4
@seanmonstar
Copy link
Contributor Author

blocking #13831

@hirschenberger
Copy link
Contributor

I'm working on that issue

@hirschenberger
Copy link
Contributor

@alexcrichton I think we can close this issue

@alexcrichton
Copy link
Member

Thanks @hirschenberger!

arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
…kril

Use `rustc_safe_intrinsic` attribute to check for intrinsic safety

Instead of maintaining a list that is poorly kept in sync we can just use the attribute.

This will make new RA versions unusable with old toolchains that don't have the attribute yet. Should we keep maintaining the list as a fallback or just don't care?
arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
…Veykril

minor: remove unused known `Name`s

After rust-lang#13866, known `Name`s for safe intrinsics are no longer used and thus should be removed.
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

3 participants