Rust idiom cleanup: sort_by_key→sort_by, vec![]→Vec::new(), remove dead_code#819
Open
wangzi111333 wants to merge 1 commit into
Open
Rust idiom cleanup: sort_by_key→sort_by, vec![]→Vec::new(), remove dead_code#819wangzi111333 wants to merge 1 commit into
wangzi111333 wants to merge 1 commit into
Conversation
…ad_code - grey-rpc: replace sort_by_key with clone with sort_by cmp (avoids String allocation per comparison in metrics formatting) - grey-state/accumulate: vec![] → Vec::new() in return positions (4), remove #[allow(dead_code)] from FetchContext (no unused fields) - grey-merkle: vec![] → Vec::new() in return position - grey-erasure: vec![] → Vec::new() in Ok return - javm/interpreter: vec![] → Vec::new() in return position - grey/tickets: vec![] → Vec::new() in return positions (2) Refs jarchain#186.
Contributor
Genesis ReviewComparison targets:
How to reviewPost a comment with the following format (rank from best to worst): Use the short commit hashes above and To meta-review another reviewer's comment, react with 👍 or 👎. |
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
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.
Summary
sort_by_key(|(k, _)| (*k).clone())withsort_by(|a, b| a.0.cmp(b.0))— eliminates String allocation per comparison in metrics formatting (2 sites)vec![]→Vec::new(): 10 return-position replacements across grey-state, grey-merkle, grey-erasure, javm/interpreter, grey/tickets#[allow(dead_code)]fromFetchContext(all fields are used)Refs #186