From edc3605770847bd971fffb8acc9de4d0685cbf8b Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Thu, 8 Apr 2021 23:00:54 +0200 Subject: [PATCH] [#13] small changes --- src/ivago/controller/pickup_times.rs | 3 ++- src/ivago/controller/structs/basic_date.rs | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ivago/controller/pickup_times.rs b/src/ivago/controller/pickup_times.rs index d2721f9..95d080c 100644 --- a/src/ivago/controller/pickup_times.rs +++ b/src/ivago/controller/pickup_times.rs @@ -45,7 +45,8 @@ pub fn get_pickup_times( .iter() .filter(|m| m.contains_key("date") && m.contains_key("label")) { - // Because we filtered the maps in the loop, we can safely us unwrap here + // Because we filtered the maps in the loop, we can safely use unwrap + // here if let Ok(date) = BasicDate::try_from(map.get("date").unwrap().as_str()) { output.push(PickupTime::new(date, map.get("label").unwrap().to_string())) } diff --git a/src/ivago/controller/structs/basic_date.rs b/src/ivago/controller/structs/basic_date.rs index 7468da5..38c6f6c 100644 --- a/src/ivago/controller/structs/basic_date.rs +++ b/src/ivago/controller/structs/basic_date.rs @@ -13,7 +13,6 @@ use std::convert::TryFrom; #[derive(Debug, PartialEq)] pub struct BasicDate(pub DateTime); -/// This allows us to use BasicDate as a query parameter in our routes. impl<'v> FromFormValue<'v> for BasicDate { type Error = &'v RawStr; @@ -25,7 +24,6 @@ impl<'v> FromFormValue<'v> for BasicDate { } } -/// This is used to serialize BasicDate. impl TryFrom<&str> for BasicDate { type Error = FejError;