num-derive
num-derive copied to clipboard
Use of `num_derive::FromPrimitive` throws Clippy lint `clippy::use_self`
I've just bumped my tool-chain release up from nightly-2021-02-20
to nightly-2021-06-04
and a new warning arises for the num_derive::FromPrimitive
derive macro.
The Clippy lint clippy::use_self
is thrown for the following derive macro use-case:
ref: https://rust-lang.github.io/rust-clippy/master/#use_self
That's currently labeled "Nursery" and is allowed by default. I find that a rather pedantic style lint, and not really relevant to macro-generated code. That said, if Self
does work in that position even in MSRV 1.31, I'd be fine with a PR changing it.
While I'm at it, you mind if I fix any other Clippy lints that come up do you prefer I just patch this one instance?
Actually, this lint might not even originate from the num-derive
crate, I strictly denied the clippy::use_self
lint and not a single lint presented itself, I then required the crate from a local path and the lint is still present. Might be a Clippy false-positive.
Ah, there are subtle differences in how "local" crates are treated for stuff like this. I know that "remote" crates are built with --cap-lints allow
, but I'm not exactly sure how that affects proc-macro-generated code.
The same problem haunts a number of other crates. It is tracked in clippy here: https://github.com/rust-lang/rust-clippy/issues/6902
Clippy seems to exempt the proc-macro code now! rust-lang/rust-clippy#8694