Skip to content

Rust idiom cleanup: sort_by_key→sort_by, vec![]→Vec::new(), remove dead_code#819

Open
wangzi111333 wants to merge 1 commit into
jarchain:masterfrom
wangzi111333:refactor/remove-dead-code-config
Open

Rust idiom cleanup: sort_by_key→sort_by, vec![]→Vec::new(), remove dead_code#819
wangzi111333 wants to merge 1 commit into
jarchain:masterfrom
wangzi111333:refactor/remove-dead-code-config

Conversation

@wangzi111333
Copy link
Copy Markdown

Summary

  • grey-rpc: Replace sort_by_key(|(k, _)| (*k).clone()) with sort_by(|a, b| a.0.cmp(b.0)) — eliminates String allocation per comparison in metrics formatting (2 sites)
  • Production vec![]Vec::new(): 10 return-position replacements across grey-state, grey-merkle, grey-erasure, javm/interpreter, grey/tickets
  • grey-state/accumulate: Remove #[allow(dead_code)] from FetchContext (all fields are used)

Refs #186

…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.
@github-actions
Copy link
Copy Markdown
Contributor

Genesis Review

Comparison targets:

How to review

Post a comment with the following format (rank from best to worst):

/review
difficulty: <commit1>, <commit2>, ..., <commitN>, currentPR
novelty: <commit1>, <commit2>, ..., <commitN>, currentPR
design: <commit1>, <commit2>, ..., <commitN>, currentPR
verdict: merge

Use the short commit hashes above and currentPR for this PR.
Each line ranks all comparison targets + this PR from best to worst.

To meta-review another reviewer's comment, react with 👍 or 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant