From 1aaf8247ab7db999d292db6d8977152bc2f84cd8 Mon Sep 17 00:00:00 2001 From: Brendan O'Connell Date: Thu, 25 Apr 2024 14:19:08 +0200 Subject: [PATCH] Refactored to remove match from fn withdrawn_date_before_publication_date_error --- thoth-api/src/model/work/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/thoth-api/src/model/work/mod.rs b/thoth-api/src/model/work/mod.rs index 3312bd98d..6046a431d 100644 --- a/thoth-api/src/model/work/mod.rs +++ b/thoth-api/src/model/work/mod.rs @@ -366,13 +366,12 @@ pub trait WorkProperties { } fn withdrawn_date_before_publication_date_error(&self) -> ThothResult<()> { - match (self.withdrawn_date(), self.publication_date()) { - (Some(withdrawn_date), Some(publication_date)) if withdrawn_date < publication_date => { - println!("withdrawn_date: {:?}", self.withdrawn_date()); - println!("publication_date: {:?}", self.publication_date()); + if let (Some(withdrawn_date), Some(publication_date)) = + (self.withdrawn_date(), self.publication_date()) + { + if withdrawn_date < publication_date { return Err(ThothError::WithdrawnDateBeforePublicationDateError); } - _ => {} } Ok(()) }