-
Notifications
You must be signed in to change notification settings - Fork 382
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 allow(clippy::all)
instead of allow(clippy)
as reccomended.
#332
Conversation
CI builds fail. |
16d6329
to
bc81851
Compare
@stepancheg Should be good to go. |
I'm running into this issue on my lints (I like to treat linter warnings as errors in CI). Any chance that this could be merged for a new release? |
This commit fixes all clippy warnings (except for two; see stepancheg/rust-protobuf#332). Additionally, clippy is added to the CI image and enabled in the CircleCI build definition.
Well, the problem with this version of patch is that it assumes that feature is named So in order to use clippy in generated code, client project must explicitly declare that feature which name is hardcoded. I have a couple of ideas how to solve it:
|
@stepancheg Clippy explicitly adds this feature when run: https://github.com/rust-lang-nursery/rust-clippy#allowingdenying-lints |
@Hoverbear thank you for the explanations! I will merge the PR soon. |
Pushed to master as 493de4d. |
Merged to 2.1 branch... |
Published v2.1.3. Thank you! |
It looks like this generates code that doesn't work with stable clippy:
I can't find a way to make it work with stable clippy - is it expected that rust-protobuf requires nightly clippy? I've tried adding this to my crate as suggested above, but it looks like clippy is still failing:
|
I don't know what to do, because I don't use clippy myself. Should I revert that diff? |
Oh no, I'm sorry. We use nightly so I didn't think of it. Right now using |
Would it work to do something like this?
(I can't tell if that syntax compiles and works, or is just ignored, this syntax might also have to be used.
It might be worth running clippy in travisci, even if you ignore the lint warnings that it gives, since compilation errors like this would still get alerted |
I'll revert that diff for now, and let's decide how to do this thing properly. |
…ended." See discussion in #332
Just FYI, I got around this by adding the following to the mod declaration: Clippy then did not generate any warnings for the protobuf code. |
any ideas on how to get this into master? |
Initially I had hoped that the deprecated `#![allow(clippy)]` would no longer be put into the generated rust files, but -- as of 2019-01-30 -- it still is (see [1] for details). Since we explicitly update the protobuf files I decided to *manually edit the generated code* and replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do the next upgrade, no such manual tweaking would be necessary anymore. I think the benefit of a less polluted clippy output is worth it this time. [1]: stepancheg/rust-protobuf#332
Initially I had hoped that the deprecated `#![allow(clippy)]` would no longer be put into the generated rust files, but -- as of 2019-01-30 -- it still is (see [1] for details). Since we explicitly update the protobuf files I decided to *manually edit the generated code* and replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do the next upgrade, no such manual tweaking would be necessary anymore. I think the benefit of a less polluted clippy output is worth it this time. [1]: stepancheg/rust-protobuf#332
Initially I had hoped that the deprecated `#![allow(clippy)]` would no longer be put into the generated rust files, but -- as of 2019-01-30 -- it still is (see [1] for details). Since we explicitly update the protobuf files I decided to *manually edit the generated code* and replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do the next upgrade, no such manual tweaking would be necessary anymore. I think the benefit of a less polluted clippy output is worth it this time. [1]: stepancheg/rust-protobuf#332
* Fix rust clippy errors and warnings This fixes most of the issues raised by running clippy. A following diff will enable clippy as a default check, but this prevents CI from failing. There still are issues with automatic generated protobuf code, which is being fixed here: stepancheg/rust-protobuf#332
Running on latest stable, simply replacing |
Will that |
I guess I can open a PR and see if it passes travis ? |
@Ten0 feel free to do that! |
OK, I just checked
So I assume we just need to generate both |
OK, I committed to v2.7 d01f19c and master 1214258. CI is green (except ICE in nighly unrelated to this change). Somebody who understands how to use clippy please confirm that this is proper and sufficient fix. |
No it's not enough. Now
I don't know is it possible to mute this warning. |
... which is completely unreasonable: |
So I think we should just drop |
Published 2.7.0. |
Initially I had hoped that the deprecated `#![allow(clippy)]` would no longer be put into the generated rust files, but -- as of 2019-01-30 -- it still is (see [1] for details). Since we explicitly update the protobuf files I decided to *manually edit the generated code* and replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do the next upgrade, no such manual tweaking would be necessary anymore. I think the benefit of a less polluted clippy output is worth it this time. [1]: stepancheg/rust-protobuf#332
Closes #331 .
Note this currently requires a nightly only feature. Users would have to be using something like:
#![cfg_attr(feature = "cargo-clippy", feature(tool_lints))]