From cde61bbdc3f921ffe4346f426936a57ac74b2ddc Mon Sep 17 00:00:00 2001 From: Hendrik Maus Date: Thu, 14 Jul 2022 09:03:09 +0200 Subject: [PATCH] chore: replace previous comparison with match as well --- tools/release-operator/src/registry.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/release-operator/src/registry.rs b/tools/release-operator/src/registry.rs index 82df1c84d..18302e054 100644 --- a/tools/release-operator/src/registry.rs +++ b/tools/release-operator/src/registry.rs @@ -157,17 +157,17 @@ impl Crate { let ours = self.get_local_version()?; - if ours == theirs { - log::info!("{self} has already been published as {ours}"); - return Ok(CrateState::Published); - } - - if ours < theirs { - log::warn!("{self} has already been published as {ours}, which is a newer version"); - return Ok(CrateState::Behind); + match theirs.cmp(&ours) { + std::cmp::Ordering::Less => Ok(CrateState::Ahead), + std::cmp::Ordering::Equal => { + log::info!("{self} has already been published as {ours}"); + Ok(CrateState::Published) + } + std::cmp::Ordering::Greater => { + log::warn!("{self} has already been published as {ours}, which is a newer version"); + Ok(CrateState::Behind) + } } - - Ok(CrateState::Ahead) } fn submit(&self, token: &SecUtf8, dry_run: bool) -> anyhow::Result<()> {