Fix Clippy warnings (#886)

This addresses the following Clippy warnings:

* clippy::option_and_then_some
* clippy::useless_format
This commit is contained in:
Sam Ford 2019-12-19 03:43:06 -05:00 committed by Vincent Prouillet
parent 8e3f1f59f6
commit 0a0b6a3ad4
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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)
};