Skip to content

Misleading "unused" warning message #27559

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
GuillaumeGomez opened this issue Aug 6, 2015 · 1 comment
Closed

Misleading "unused" warning message #27559

GuillaumeGomez opened this issue Aug 6, 2015 · 1 comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@GuillaumeGomez
Copy link
Member

We got the following warning message:

warning: variant is never used: `Foo`, #[warn(dead_code)] on by default

For this code:

enum Something {
    Foo,
    NotFoo
}

fn main() {
    match Something::NotFoo {
        Something::Foo => {}
        _ => {}
    }
}

This warning could mislead users because for them, the Foo variant is used. Adding a specific warning message could be nice.

@eddyb proposed this message instead in this case:

"this variant is never instantiated"

cc @eddyb

@sfackler sfackler added the A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. label Aug 6, 2015
@sanxiyn
Copy link
Member

sanxiyn commented Nov 4, 2015

Closing as a duplicate of #19140.

@sanxiyn sanxiyn closed this as completed Nov 4, 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

3 participants