From 6884f79e92f4bb7bc0d00b71920f7a64c48abf1e Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Tue, 9 Sep 2025 22:11:12 +0800 Subject: [PATCH] shorten retrun boolean --- src/account.rs | 3 +++ src/util.rs | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/account.rs b/src/account.rs index 5c5bd6d2..5fc3c421 100644 --- a/src/account.rs +++ b/src/account.rs @@ -783,6 +783,7 @@ impl Account { where S: Into, { + #[allow(unreachable_code)] if !is_start_time_valid(&start_time) { return bail!("Start time should be less than the current time"); } @@ -802,9 +803,11 @@ impl Account { where S: Into, { + #[allow(unreachable_code)] if end_time <= start_time { return bail!("End time should be greater than start time"); } + #[allow(unreachable_code)] if !is_start_time_valid(&start_time) { return bail!("Start time should be less than the current time"); } diff --git a/src/util.rs b/src/util.rs index 17859d6f..0682b6c7 100644 --- a/src/util.rs +++ b/src/util.rs @@ -52,11 +52,7 @@ pub fn is_start_time_valid(start_time: &u64) -> bool { .unwrap() .as_secs(); - if start_time > ¤t_time { - false - } else { - true - } + start_time <= ¤t_time } pub fn generate_uuid22() -> String {