Skip to content
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

Silly refactor for more idiomatic Rust style #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gubatron
Copy link

Cheers! Just looking around and sending some love.

  • Replaced if statements with match for checking decoded lengths in G2Element and Scalar.
  • Used format_args! instead of format! for error message construction to avoid unnecessary memory allocations.

…s!` for a more idiomatic Rust style

- Replaced `if` statements with `match` for checking decoded lengths in `G2Element` and `Scalar`.
- Used `format_args!` instead of `format!` for error message construction to avoid unnecessary memory allocations.
@gubatron
Copy link
Author

format_args! produces a fmt::Arguments object, which is more efficient than allocating a String.

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