From 0a0b6a3ad4b545a8db3ef28534f7ce2dfd4d7ef1 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Thu, 19 Dec 2019 03:43:06 -0500 Subject: [PATCH] Fix Clippy warnings (#886) This addresses the following Clippy warnings: * clippy::option_and_then_some * clippy::useless_format --- components/front_matter/src/page.rs | 4 ++-- components/library/src/pagination/mod.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/front_matter/src/page.rs b/components/front_matter/src/page.rs index 3d70ff18..bf9b5237 100644 --- a/components/front_matter/src/page.rs +++ b/components/front_matter/src/page.rs @@ -87,11 +87,11 @@ impl PageFrontMatter { pub fn date_to_datetime(&mut self) { self.datetime = if let Some(ref d) = self.date { if d.contains('T') { - DateTime::parse_from_rfc3339(&d).ok().and_then(|s| Some(s.naive_local())) + DateTime::parse_from_rfc3339(&d).ok().map(|s| s.naive_local()) } else { NaiveDate::parse_from_str(&d, "%Y-%m-%d") .ok() - .and_then(|s| Some(s.and_hms(0, 0, 0))) + .map(|s| s.and_hms(0, 0, 0)) } } else { None diff --git a/components/library/src/pagination/mod.rs b/components/library/src/pagination/mod.rs index 92d019a7..95927aa4 100644 --- a/components/library/src/pagination/mod.rs +++ b/components/library/src/pagination/mod.rs @@ -190,7 +190,7 @@ impl<'a> Paginator<'a> { } paginator.insert("number_pagers", to_value(&self.pagers.len()).unwrap()); let base_url = if self.paginate_path.is_empty() { - format!("{}", self.permalink) + self.permalink.to_string() } else { format!("{}{}/", self.permalink, self.paginate_path) };