-
Notifications
You must be signed in to change notification settings - Fork 404
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
Some more cleanup suggested by cargo clippy #402
Merged
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
These were flagged by `cargo clippy`: warning: length comparison to zero
These were flagged by `cargo clippy`: warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let` This also silences a few cases where the match couldn't be replaced with an if because of the following error: error: attributes are not yet allowed on `if` expressions Once we increase the minimum Rust version to 1.43, these can be updated as well.
These were flagged by `cargo clippy`: warning: you don't need to add `&` to all patterns This should have happened in ac830e8, but I guess I missed it.
Dirbaio
requested changes
Dec 27, 2020
These were flagged by `cargo clippy`: warning: this seems like a manual implementation of the non-exhaustive pattern The non_exhaustive attribute isn't available until we increase the minimum Rust version to 1.40, so we should just silence these warnings in the meantime.
These were flagged by `cargo clippy`: warning: item has a public `len` method but no corresponding `is_empty` method
These were flagged by `cargo clippy`: warning: match expression looks like `matches!` macro The matches! macro isn't stabilized until Rust 1.42.
These were flagged by `cargo clippy`: warning: manual implementation of an assign operation
These were flagged by `cargo clippy`: warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
These were flagged by `cargo clippy`: warning: calling `subsec_millis()` is more concise than this calculation
These were flagged by `cargo clippy`: warning: redundant closure found
These were flagged by `cargo clippy`: warning: called `is_some()` after searching an `Iterator` with find. This is more succinctly expressed by calling `any()`. warning: this `.into_iter()` call is equivalent to `.iter_mut()` and will not consume the `BTreeMap` warning: called `skip_while(p).next()` on an `Iterator` The skip_while conversion is a little tricky. Clippy notes that: warning: called `skip_while(p).next()` on an `Iterator` help: this is more succinctly expressed by calling `.find(!p)` instead So the condition of the skip_while is inverted and then simplified using De Morgan's laws.
Very nice! Thanks! |
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.
This is a follow-on to #395. I still have some more changes locally, but I can follow up with another pull request once I get them cleaned up a bit.