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

feat: use the < operator instead of cmp method to improve readability #10268

Merged
merged 1 commit into from
Nov 30, 2023

Commits on Nov 29, 2023

  1. feat: use the < operator instead of cmp method to improve readability

    The following code is currently used for comparing `boundary_account` and `account_id`:
    ```rust
    if boundary_account.cmp(account_id) == Greater {
        ...
    }
    ```
    
    IMO it's a bit confusing - it isn't immediately obvious whether this means `boundary_account` > `account_id`
    or `account_id` > `boundary_account`. I misread this line and because of that I made a mistake in near#10240.
    
    Let's change it to something that is easier to read:
    ```rust
    if account_id < boundary_account {
        ...
    }
    ```
    jancionear committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    cae8e8c View commit details
    Browse the repository at this point in the history