-
Notifications
You must be signed in to change notification settings - Fork 168
Clear some more clippy warnings #400
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
Merged
Merged
Conversation
This file contains hidden or 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
Clippy emits: warning: redundant field names in struct initialization As suggested, use struct init shorthand.
Clippy emits: warning: immediately dereferencing a reference As suggested remove the unnecessary `*&mut`.
Rustdoc examples do not need to include a main function. Improve the rustdoc lib top level rustdoc by doing: - Remove `fn main` (clears clippy warning) - Use newly improved sanity checks docs from examples/ - Fix import statement
Clippy emits: warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice` As suggested, use `iter` instead of `into_iter`.
We cannot implement `std::str::FromStr` because of the lifetimes we use. Shoosh clippy.
Clippy emits: warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration) As suggested, remove the explicit lifetimes.
Clippy emits: warning: casting integer literal to `usize` is unnecessary As suggested, remove the unnecessary cast.
Improve docs on parse method by doing: - Refactor the docs example code (remove unneeded `fn main`) - Use backticks for types inside links Clears a clippy warning.
Clippy emits: warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)` As suggested, use `map` instead of `and_then`.
Clippy emits two instances of: warning: manual implementation of `Option::map` For the first, use `allow` to shoosh clippy, the call site is a chain of if/else if/else and is best left as it is. For the other instance do as suggested and use `map`.
Clippy emits: warning: redundant pattern matching, consider using `is_err()` As suggested, use `is_err` instead of pattern matching.
Clippy emits: warning: this `.fold` can be written more succinctly using another method As suggested, use `any` instead of `fold`.
Clippy emits: warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` As suggested, use `take` instead of `replace`.
Clippy emits: warning: the loop variable `i` is only used to index `casts` As suggested, use an iterator.
Clippy emits: warning: redundant clone As suggested, remove redundant call to clone.
Clippy emits: warning: calls to `push` immediately after creation As suggested, use `vec![]`.
Clippy emits: warning: length comparison to zero As suggested use `is_empty`.
sanket1729
approved these changes
May 10, 2022
Member
sanket1729
left a comment
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.
Thanks for doing this. ACK cc1444d
Member
Author
My pleasure, we will have the whole place lint free soon enough! |
heap-coder
added a commit
to heap-coder/rust-miniscript
that referenced
this pull request
Sep 27, 2025
cc1444df64d221bec1ad74a8f57db7332a5cc714 Use is_empty instead of comparison to 0 (Tobin C. Harding)
0421dfd921d39f58bb18ed440f47412e40657e60 Use vec macro instead of mut and push (Tobin C. Harding)
5155193286f16b4bbc2bcecee4e46aa541907728 Remove redundant clone (Tobin C. Harding)
035ff5b045a1b83ddcd398617e02bcfd36bc850f Use an iterator to iterate over casts (Tobin C. Harding)
b6c432bba72590bfb46c1af358bb4d41bf5915de Use take instead of replace with default (Tobin C. Harding)
c025403efe7d1c9f623cf05e00316f91c14bd937 Use any instead of fold (Tobin C. Harding)
42033dd47e452e8be1a46a234ff22484cb83377f Use is_err instead of pattern matching (Tobin C. Harding)
a024e75ccd18e7a2cb878540c4f50858db277f83 Fix manual implementation of Option::map warnings (Tobin C. Harding)
bb1e916b1974476220cb2afd319ee2d900b25f60 Use map instead of and_then (Tobin C. Harding)
7816a5f262d841014406006f74b2503432086145 Improve docs on parse method (Tobin C. Harding)
6ced1c0c5ed94df29e21534a47805286549bc796 Remove unnecessary cast (Tobin C. Harding)
1a025149f1e70cc2f497d335c5398b011b02c964 Remove explicit lifetimes (Tobin C. Harding)
80f9f14d8e0a4612f0e6763b060177dc33f80778 Add clippy allow for from_str method (Tobin C. Harding)
ff32f9513a137774e8a8ed293c829b5083abb763 Use iter instead of into_iter (Tobin C. Harding)
b6be0bee782fc00c0e7f40bedbdf2b036bfc0240 Fix doc example (Tobin C. Harding)
36ae791211236b6a046bb49818857c123b5f5de3 Remove unnecessary *&mut (Tobin C. Harding)
5596d07cf91854a0f46cb5216e69ac7eb1cedfb9 Use struct init shorthand (Tobin C. Harding)
Pull request description:
Clear all the remaining non-controversial clippy warnings.
Should be just the curly ones left after this.
ACKs for top commit:
sanket1729:
Thanks for doing this. ACK cc1444df64d221bec1ad74a8f57db7332a5cc714
Tree-SHA512: f0041faa8bcb9ba5b0db5c0be21d2b44c18cb188cebf2b583f72ad82e6947bd29c454fa6c723fde310a61e41f5116b93bbd29fb6f3ede2bf68e1b36fd118a6b3
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.
Clear all the remaining non-controversial clippy warnings.
Should be just the curly ones left after this.