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

Use of num_derive::FromPrimitive throws Clippy lint clippy::use_self #47

Closed
Fuwn opened this issue Jun 6, 2021 · 6 comments
Closed

Comments

@Fuwn
Copy link

Fuwn commented Jun 6, 2021

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:


@cuviper
Copy link
Member

cuviper commented Jun 7, 2021

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.

@Fuwn
Copy link
Author

Fuwn commented Jun 7, 2021

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?

@Fuwn
Copy link
Author

Fuwn commented Jun 7, 2021

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.

@cuviper
Copy link
Member

cuviper commented Jun 7, 2021

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.

@barafael
Copy link

barafael commented May 2, 2022

The same problem haunts a number of other crates. It is tracked in clippy here: rust-lang/rust-clippy#6902

@cuviper
Copy link
Member

cuviper commented Nov 2, 2022

Clippy seems to exempt the proc-macro code now! rust-lang/rust-clippy#8694

@cuviper cuviper closed this as completed Nov 2, 2022
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