Browse Source

Fix Clippy warnings (#886)

This addresses the following Clippy warnings:

* clippy::option_and_then_some
* clippy::useless_format
index-subcmd
Sam Ford Vincent Prouillet 5 years ago
parent
commit
0a0b6a3ad4
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      components/front_matter/src/page.rs
  2. +1
    -1
      components/library/src/pagination/mod.rs

+ 2
- 2
components/front_matter/src/page.rs View File

@@ -87,11 +87,11 @@ impl PageFrontMatter {
pub fn date_to_datetime(&mut self) { pub fn date_to_datetime(&mut self) {
self.datetime = if let Some(ref d) = self.date { self.datetime = if let Some(ref d) = self.date {
if d.contains('T') { 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 { } else {
NaiveDate::parse_from_str(&d, "%Y-%m-%d") NaiveDate::parse_from_str(&d, "%Y-%m-%d")
.ok() .ok()
.and_then(|s| Some(s.and_hms(0, 0, 0)))
.map(|s| s.and_hms(0, 0, 0))
} }
} else { } else {
None None


+ 1
- 1
components/library/src/pagination/mod.rs View File

@@ -190,7 +190,7 @@ impl<'a> Paginator<'a> {
} }
paginator.insert("number_pagers", to_value(&self.pagers.len()).unwrap()); paginator.insert("number_pagers", to_value(&self.pagers.len()).unwrap());
let base_url = if self.paginate_path.is_empty() { let base_url = if self.paginate_path.is_empty() {
format!("{}", self.permalink)
self.permalink.to_string()
} else { } else {
format!("{}{}/", self.permalink, self.paginate_path) format!("{}{}/", self.permalink, self.paginate_path)
}; };


Loading…
Cancel
Save