From eae540e3e7324124640953d77ef998a6939eeb08 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 21 Jun 2024 10:46:29 +0900 Subject: [PATCH] remove unchecked unwrap --- src/command/config/update.rs | 2 +- src/command/config/validate.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command/config/update.rs b/src/command/config/update.rs index 619c191..ef15ea8 100644 --- a/src/command/config/update.rs +++ b/src/command/config/update.rs @@ -62,7 +62,7 @@ async fn update_to(revision: Revision) -> Result<(), UpdateError> { pub(super) async fn run(revision: Option) -> Result<(), UpdateError> { let current_revision = current_revision()?; - if current_revision == Revision::last().unwrap() { + if current_revision.next().is_none() { println!("Your config files are already up-to-date! (as of this fishctl release)"); return Ok(()); } diff --git a/src/command/config/validate.rs b/src/command/config/validate.rs index e6dd20a..43c1bf9 100644 --- a/src/command/config/validate.rs +++ b/src/command/config/validate.rs @@ -2,7 +2,7 @@ use crate::{ command::config::{current_revision, RevisionCheckError}, - config::{client, server, Revision, CLIENT_CONFIG_PATH, SERVER_CONFIG_PATH}, + config::{client, server, CLIENT_CONFIG_PATH, SERVER_CONFIG_PATH}, }; use color_print::cprintln; use enum_iterator::Sequence; @@ -31,7 +31,7 @@ enum ReadError { } pub(super) fn run() -> Result<(), ValidationError> { - if current_revision()? != Revision::last().unwrap() { + if current_revision()?.next().is_some() { cprintln!("Please first run `fishctl config update` to update your config files."); return Err(ValidationError::OutOfDate); }