Update smoke test to verify all Clippy and rustc lints #374
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.
Why
Different projects will have different combinations of rustc and Clippy lints enabled, including lints from the
clippy::restriction
andclippy::pedantic
groups, that are allowed by default. This results in a situation where users of bitflags, depending on their configuration, will have linting errors that they are unable to easily resolve.What
This updates the smoke test to include all lints from Clippy rustc, that are allowed by default. This allows CI to verify that any changes to bitflags that would result in a failing lint can be caught immediately.
The Clippy lints can be enabled in bulk, since all the lints are contained within one of a small set of rather stable groups. The rustc lints, however, are more difficult, as there are several lints that are not included in any group. As far as I am aware, there is not a way to enable all lint using something like
deny(allows)
, or similar.Justification
I started making this change because I have
clippy::same_name_method
enabled in a project, which was causing bitflags to fail. Once I had addressed that particular issue in a local copy, I had issues withclippy::indexing_slicing
failing in a different project.From there I decided to test is there were any further errors, and this was the end result. I decided to not include
clippy::cargo
as they should never be a problem, andclippy::nursery
as those rules often have many false positives.There are two drawbacks to this approach. The first is that the "list" of lints (particularly from rustc) will need to be maintained as new lints are added. I do not think this will be too much of a burden when compared to the effort of addressing linting issues from users, and not having the lints listed is the current state.
The second drawback, is that as new lints are added to the groups denied for Clippy or rustc, new changes may require additional allowed lints. However, not addressing these lints could result in breaking projects that use bitflags.