Resolve all lints and formating; split style checks into separate job #2147
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.
This PR resolves all clippy lints and formats the codebase. It also splits the formatting and clippy CI checks into a separate job and makes them 'mandatory'; really this means that the clippy/fmt check may show as failed but the regular build-test jobs will continue as normal, and you can choose to merge with outstanding clippy/formatting issues if you want.
My goal here is to make clippy suggestions and autoformatting actually useful during development if you have it set up. It's very good at finding better ways to represent something for new and experienced rust devs alike, but it's not very useful if the suggestion you need is buried under a pile of 400+ other suggestions. Hence this PR: rip off the bandaid once so the suggestions become useful again.
I intentionally tried to avoid making behavioral changes, and our test suite backs us up here. To give a flavor of applied changes here are some common lints that were fixed:
if let
construct instead ofmatch
for single match armsmatches!()
macro instead ofmatch
when all match arms return true and the default arm returns falseallow(clippy::
to see the list)assert!()
instead ofassert_eq!(_, bool)
while
tofor
etc)This basically touches all rust files which could result in shadowing potentially useful historical context when viewing the history or blame of a file. To mitigate this issue I added the lint/formatting commit id to a new
.git-blame-ignore-revs
file which is a list of commits that both git and github.com can use to skip commits that make bulk changes to a repo. See GitHub docs.There are a lot of changes here, and I understand that not coordinating a change like this ahead of time could make accepting this pr complicated and may require extra work to make ready to merge.