-
Notifications
You must be signed in to change notification settings - Fork 41
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
Try to clean up some lints and enable more #923
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I came across the unused_extern_crates lint, which is allow-by-default. It is however part of the rust_2018_idioms lint group, which we are already denying. Anyway, this discovery led me down a linting rabbit hole. There is the unused_import_braces lint which arguable lints against something that rustfmt already deals with. Both the lint and rustfmt deal with the braces in "use test::{A};". Thus, this lint can just be dropped. The "unused" lint group includes "unused_must_use" and some other things that sound helpful, so let's just switch to the more generic lint. This found some unused_macro_rules in x11rb/src/tracing.rs, which need to be allowed, so this lint can just be denied and not forbidden. But some of the lints that we forbid are part of the "unused" group and #[deny]ing something that was previously #[forbid]en is an error. Thus, I am switching the order of these and move all the #[deny]s up. Next, I thought that "unused_qualifications" should be part of "unused", but it actually is not. The following code warns about the allows for unused_extern_crates and unused_must_use, but not unused_qualifications, so this is not part of the unused group. Same for unused_results. #![forbid(unused)] #![allow(unused_extern_crates)] #![allow(unused_must_use)] #![allow(unused_qualifications)] #![allow(unused_results)] Signed-off-by: Uli Schlachter <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #923 +/- ##
==========================================
- Coverage 13.06% 13.06% -0.01%
==========================================
Files 191 191
Lines 136668 136678 +10
==========================================
Hits 17860 17860
- Misses 118808 118818 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Since Rust 2021, TryFrom and TryInto are part of the prelude. Signed-off-by: Uli Schlachter <[email protected]>
Signed-off-by: Uli Schlachter <[email protected]>
Drop is part of the prelude. Signed-off-by: Uli Schlachter <[email protected]>
Signed-off-by: Uli Schlachter <[email protected]>
TryFrom, TryInto, and drop are all part of the prelude in Rust 2021. Signed-off-by: Uli Schlachter <[email protected]>
Signed-off-by: Uli Schlachter <[email protected]>
Signed-off-by: Uli Schlachter <[email protected]>
Signed-off-by: Uli Schlachter <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I came across the unused_extern_crates lint, which is allow-by-default. It is however part of the rust_2018_idioms lint group, which we are already denying.
Anyway, this discovery led me down a linting rabbit hole.
There is the unused_import_braces lint which arguable lints against something that rustfmt already deals with. Both the lint and rustfmt deal with the braces in "use test::{A};". Thus, this lint can just be dropped.
The "unused" lint group includes "unused_must_use" and some other things that sound helpful, so let's just switch to the more generic lint. This found some unused_macro_rules in x11rb/src/tracing.rs, which need to be allowed, so this lint can just be denied and not forbidden. But some of the lints that we forbid are part of the "unused" group and #[deny]ing something that was previously #[forbid]en is an error. Thus, I am switching the order of these and move all the #[deny]s up.
Next, I thought that "unused_qualifications" should be part of "unused", but it actually is not. The following code warns about the allows for unused_extern_crates and unused_must_use, but not unused_qualifications, so this is not part of the unused group. Same for unused_results.
I now feel confused about lints. Is this PR still a good idea? Does it improve anything?