-
Notifications
You must be signed in to change notification settings - Fork 258
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
refactor: apply a bunch of lints #974
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #974 +/- ##
=====================================
Coverage 91.9% 91.9%
=====================================
Files 61 61
Lines 15964 15905 -59
=====================================
- Hits 14673 14632 -41
+ Misses 1291 1273 -18 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I agree with all the changes generally (with a couple of questions / comments). I ended up just looking at the entire PR as I saw your comment about looking at each commit after I reviewed.
I like your thoughts on merging this as multiple commits generally, but I think I'm also fine with squashing the changes as this fits better with the workflow (and avoids having to split this into multiple PRs). There's only a few outstanding PRs right now, and the benefit of this PR outweighs the extra work to rebase them if needed.
I recall that there's a way to mark specific commits not to be included when annotating the file with git blame - perhaps we need that for this PR?
P.s. thanks for all the effort on this one - much appreciated!
Fixes many not yet enabled lints (mostly pedantic) on everything that is not the lib (examples, benchs, tests). Therefore, this is not containing anything that can be a breaking change. Lints are not enabled as that should be the job of #974. I created this as a separate PR as its mostly independent and would only clutter up the diff of #974 even more. Also see #974 (comment) --------- Co-authored-by: Josh McKinney <joshka@users.noreply.github.com>
I applied the suggestions and added more lints. So its probably a good idea to review this completely again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (I re-reviewed all the changed files since last review line by line).
I'd like to undo the changes to the u32 literals in the Color files, because the 3 byte values are actually more readable than the 4 byte values Perhaps keep the warn in the lint config, but add allow
s on the 3 files in question. d76a789 is the commit in question. Does that make sense?
I plan to merge this as a rebase - do you think it would be worth adding the PR number to all the commit messages to make it easy to link back to this PR and the comments (for anyone spelunking the codebase at some later date)?
Perhaps as a last thing to add for this, would you mind creating a .git-blame-ignore-revs file that marks these commits from blame (to make it easier to understand the blame output)? See https://git-scm.com/docs/git-blame / https://www.michaelheap.com/git-ignore-rev/ (or other blog posts for details).
P.s. this was really done well. I wonder if you might might consider writing an article / blog post on the approach you took to doing this in a controlled manner. Some things I'd really like to read about (and I'm sure others might feel the same) were:
|
Lint enabled by default but only nightly finds this yet
enabled by default, only detected on nightly yet
enabled by default, only detected by nightly yet
configure lints in Cargo.toml requires 1.74.0 BREAKING CHANGE: rust 1.74 is required now
its not needed and can just be assumed related: clippy::(un)separated_literal_suffix
…-org#974) enabled by default on nightly
These lints dont generate warnings and therefore dont need refactoring. I think they are useful in the future.
In the beginning I wanted to add
const
improvements to widgets I use, but then I thought I should apply a bunch of lints first before doing more refacting likeconst
new methods.Applying them to the whole project is similar in comparison to just a few files, so I did that.
I ran my personal bunch of lints over the entire project (pedantic, nursery and some restricted) and applied some of them. I went through the lints and checked what is at least partially done already in this repo to ensure a consistent state. For example
use_self
is partially used in this repo. The lint ensures its done everywhere consistently. The same with the other lints.Currently, lints which did not trigger at least some kind of refactoring are not added. In the long run I would like to enable
clippy::pedantic
(except lints likemodule_name_repetitions
) for this project.This creates a lot of changes but except the change to the
WidgetRef
it should not be a breaking change. (It somewhat amazed me that theWidgetRef
API required ownership and not a reference or have I overlooked something? It's in its own commit)This probably creates some churn with other PR created before this is merged.
Looking at all the changes together is somewhat pointless. Each commit should be checked on its own. It should also be considered if this should be squashed on merge like the other PR do normally. I think it's useful to keep the commits individually. But that is not my decision.
I can rebase this and add/improve/remove commits/lints. I can also cherry-pick some into their own PR to fast-lane them. We should discuss the lints.