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

--no-default-features support #4860

Closed
o0Ignition0o opened this issue Nov 28, 2019 · 5 comments
Closed

--no-default-features support #4860

o0Ignition0o opened this issue Nov 28, 2019 · 5 comments

Comments

@o0Ignition0o
Copy link

As explained in our attempts to progressively enable clippy::pedantic to neqo, we ended up trying to feature-gate #[deny(warnings)], having it enabled as the default feature set.

As I'm trying to work on cargo-scout, which will only warn you on lints that affect your diff / pull request, I'm trying to run clippy with the default feature set disabled (and enabling features if / when required).

I have noticed there's a way to tell cargo to not compile default features and override them by using the --no-default-features flag

Maybe I have misread the documentation or misused the options, but I can't seem to be able to propagate it to clippy.

I'm willing to work on a way to pass this flag to clippy, as well as maybe handle --features "foo bar baz" in the process, but I have never worked on clippy yet.

The command would look something like:

cargo clippy --features "deny-warnings" -- -W clippy::pedantic
cargo clippy --no-default-features -- -W clippy::pedantic

I suppose it could be achieved, given clippy already has an all-features flag, but I didn't dig too far yet.

Could someone please let me know if that would make sense, if it was ok if I tried to work on it, and if someone could mentor me / provide me with general directions as to how to proceed ?

Thank you again for your time :)

@flip1995
Copy link
Member

I just tested this and Clippy, worked with both --features and --no-default-features. All the features and target flags should just get passed through to cargo. So if it works with cargo check it should work with cargo clippy.

@o0Ignition0o
Copy link
Author

Oh ok, I'm going to give it an other try in an hour, maybe there's a bug somewhere else then... thank you for your time

@flip1995
Copy link
Member

Please let us know if you get different results with cargo check than with cargo clippy. Note that the features flags won't get passed to the members of workspaces.

@o0Ignition0o
Copy link
Author

Good catch, this is the exact setup I'm working with.

I'm going to give it an other try in a workspace subfolder then, which will probably turn out to be ok, and i will then dig through rust-lang/cargo#4942 to work around it, thanks a lot for the hint !

@o0Ignition0o
Copy link
Author

I just tested it and you were correct, the command works fine in a workspace subfolder.
Closing the issue, thank's a lot for your time and really great insights !

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

2 participants