Skip to content

Commit

Permalink
chore: replace previous comparison with match as well
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmaus committed Jul 14, 2022
1 parent de0ba1b commit cde61bb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tools/release-operator/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down

0 comments on commit cde61bb

Please sign in to comment.