-
Notifications
You must be signed in to change notification settings - Fork 433
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
Last round of suggestions by clippy #403
Conversation
These were flagged by `cargo clippy`: warning: redundant field names in struct initialization There are plenty more redundant field names, but I only changed the ones where the initialization was a single line of code. I still prefer the redundant style for multi-line initializations (and I'm under the impression that others agree), so I've also disabled the warning.
These were flagged by `cargo clippy`: warning: this `else { if .. }` block can be collapsed
These were flagged by `cargo clippy`: warning: returning the result of a `let` binding from a block warning: this import is redundant
These were flagged by `cargo clippy`: warning: the loop variable is used to index I've verified that this doesn't increase the size of consuming binaries. Pretty impressive. I tested this with a project that uses the following features: ethernet, proto-dhcpv4, socket-tcp.
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.
I've reviewed individual commits and I agree with almost all of your judgement calls (except where noted). Good work!
These were flagged by `cargo clippy`: warning: the operation is ineffective. Consider reducing it to `number` warning: this function has too many arguments (8/7) warning: you should consider adding a `Default` implementation for `phy::loopback::Loopback` I like the code better as it is.
This was flagged by `cargo clippy`: warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` I decided to disable this because it was suggesting changes like the following and I prefer the original: @@ -1 +1 @@ -self.waker.take().map(|w| w.wake()); +if let Some(w) = self.waker.take() { w.wake() }
I want to double check that the clippy check actually fails this time. I've got one final commit to address the last lint. |
These were flagged by `cargo clippy`: warning: using `clone` on a `Copy` type
This was flagged by `cargo clippy`: warning: redundant closure found
Today I learned about
That's why the job isn't failing. I'm reasonably confident this will work as-is. |
This is a follow-on to #402 and is the last in the series. Now that all of the warnings have been addressed, I've also set
cargo clippy
to fail when it encounters warnings going forward.Should we pin to a specific toolchain or do folks think it's feasible to keep up-to-date with the latest stable? I don't have a sense for how often new lints are added.