Skip to content

Commit 9de4eaa

Browse files
committed
fix: clippy error
1 parent 22fcc9d commit 9de4eaa

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

stacks-signer/src/signerdb.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -872,18 +872,23 @@ impl SignerDb {
872872
);
873873
}
874874

875-
if current_db_version < Self::SCHEMA_VERSION {
876-
sql_tx.rollback()?;
877-
return Err(DBError::Other(format!(
878-
"Database migration incomplete. Current version: {}, Target application version: {}",
879-
current_db_version, Self::SCHEMA_VERSION
880-
)));
881-
} else if current_db_version > Self::SCHEMA_VERSION {
882-
sql_tx.rollback()?;
883-
return Err(DBError::Other(format!(
884-
"Database schema is newer than SCHEMA_VERSION. SCHEMA_VERSION = {}, current_db_version = {}. Did you forget to update SCHEMA_VERSION?",
885-
Self::SCHEMA_VERSION, current_db_version
886-
)));
875+
match current_db_version.cmp(&Self::SCHEMA_VERSION) {
876+
std::cmp::Ordering::Less => {
877+
sql_tx.rollback()?;
878+
return Err(DBError::Other(format!(
879+
"Database migration incomplete. Current version: {}, SCHEMA_VERSION: {}",
880+
current_db_version,
881+
Self::SCHEMA_VERSION
882+
)));
883+
}
884+
std::cmp::Ordering::Greater => {
885+
sql_tx.rollback()?;
886+
return Err(DBError::Other(format!(
887+
"Database schema is newer than SCHEMA_VERSION. SCHEMA_VERSION = {}, Current version = {}. Did you forget to update SCHEMA_VERSION?",
888+
Self::SCHEMA_VERSION, current_db_version
889+
)));
890+
}
891+
std::cmp::Ordering::Equal => {}
887892
}
888893

889894
sql_tx.commit()?;

0 commit comments

Comments
 (0)