Simplify some comparisons using (a1, a2).cmp(&(b1, b2)) (#30321)

This commit is contained in:
Kevin Ji 2023-02-14 21:11:48 -08:00 committed by GitHub
parent 0d96d1db33
commit a36e1b211d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -559,11 +559,7 @@ impl fmt::Display for CliValidators {
}
CliValidatorsSortOrder::Version => {
sorted_validators.sort_by(|a, b| {
use std::cmp::Ordering;
match a.version.cmp(&b.version) {
Ordering::Equal => a.activated_stake.cmp(&b.activated_stake),
ordering => ordering,
}
(&a.version, a.activated_stake).cmp(&(&b.version, b.activated_stake))
});
}
}

View File

@ -93,10 +93,7 @@ impl PartialOrd for CliFeature {
impl Ord for CliFeature {
fn cmp(&self, other: &Self) -> Ordering {
match self.status.cmp(&other.status) {
Ordering::Equal => self.id.cmp(&other.id),
ordering => ordering,
}
(&self.status, &self.id).cmp(&(&other.status, &other.id))
}
}