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

Clippy error "useless lint attribute" when using FromPrimitive #20

Closed
dignifiedquire opened this issue Nov 8, 2018 · 5 comments
Closed

Comments

@dignifiedquire
Copy link

Getting this error when running latest clippy on my code, after adding FromPrimitive

error: useless lint attribute
  --> src/packet/tags/sig.rs:15:1
   |
15 | #[derive(FromPrimitive)]
   | ^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.212/index.html#useless_attribute

code is just a simple enum like this

#[derive(FromPrimitive)]
pub enum KeyFlag {
   First = 1,
   Second = 2,
}
  • rust version: rustc 1.32.0-nightly (25a42b2ce 2018-11-07)
  • clippy version: clippy 0.0.212 (d8b42690 2018-11-04)
  • num-derive: 0.2.3
@cuviper
Copy link
Member

cuviper commented Nov 8, 2018

What it does

Checks for extern crate and use items annotated with lint attributes

I think it's warning about this code in the expansion:

    #[allow(unused_qualifications)]
    extern crate num_traits as _num_traits;

That allow was added for #9, but at the time it was placed on the "dummy" const. It was moved onto this extern crate in #17. I need to make sure of what it was meant to protect exactly -- as-is, the issue-9 test fails on Rust 1.16 through 1.28, but 1.15 and 1.29+ are fine with it.

@athei
Copy link

athei commented Mar 3, 2019

What is necessary to fix this? The "useless lint attribute" is in the correctness category of clips and defaults to deny.

@cuviper
Copy link
Member

cuviper commented Mar 3, 2019

@athei probably just needs to move the lint back onto the dummy_const.

cuviper added a commit to cuviper/num-derive that referenced this issue Apr 23, 2019
@cuviper
Copy link
Member

cuviper commented Apr 23, 2019

Should be fixed by num-derive 0.2.5. Let me know if there's still an issue.

@cuviper cuviper closed this as completed Apr 23, 2019
@athei
Copy link

athei commented Apr 24, 2019

Indeed that fixed the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants