Simplify some comparisons using (a1, a2).cmp(&(b1, b2)) (#30321)
This commit is contained in:
parent
0d96d1db33
commit
a36e1b211d
|
@ -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))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue