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

refactor: streamlining DimIsNone trait and optimizing parse_u256_types #153

Merged
merged 3 commits into from
Dec 26, 2023

Conversation

codeesura
Copy link
Contributor

Motivation

The primary goal of these changes is to enhance the readability and efficiency of the code in the Args struct. In its previous state, certain functions like dim_is_none and parse_u256_types were more verbose than necessary and did not fully leverage Rust's expressive capabilities. By refactoring these functions, we aim to make the codebase cleaner, more maintainable, and easier for other contributors to understand and work with.

Solution

  1. DimIsNone Trait Refactoring:

    • Simplified the dim_is_none function by returning the negation of dim_is_some, thereby removing redundant match statements.
  2. parse_u256_types Function Optimization:

    • Refactored to use map_or and map for more idiomatic and streamlined logic.
    • Consolidated string comparisons in pattern matching to improve performance and readability.

These changes maintain the existing functionality while significantly enhancing code quality.

@sslivkoff sslivkoff merged commit ae8d152 into paradigmxyz:main Dec 26, 2023
3 checks passed
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.

2 participants