From a36e1b211d144f3cf0f2a6f68da7600b49454c1a Mon Sep 17 00:00:00 2001 From: Kevin Ji <1146876+kevinji@users.noreply.github.com> Date: Tue, 14 Feb 2023 21:11:48 -0800 Subject: [PATCH] Simplify some comparisons using (a1, a2).cmp(&(b1, b2)) (#30321) --- cli-output/src/cli_output.rs | 6 +----- cli/src/feature.rs | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/cli-output/src/cli_output.rs b/cli-output/src/cli_output.rs index 142816bf11..a53cd16af9 100644 --- a/cli-output/src/cli_output.rs +++ b/cli-output/src/cli_output.rs @@ -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)) }); } } diff --git a/cli/src/feature.rs b/cli/src/feature.rs index 82d26816fb..e231396c90 100644 --- a/cli/src/feature.rs +++ b/cli/src/feature.rs @@ -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)) } }