From 7c2454f33cb2b3d6b8005c2ab9c09ff406870b8f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 18 Dec 2018 15:34:23 +0100 Subject: Fix clippy issues. --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index d3b8872..50f3eaa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ fn parse_datetime(datetime: Option) -> Option> { return None; } - if !dt.contains("T") { + if !dt.contains('T') { dt += "T000000"; } Utc.datetime_from_str(&dt, "%Y%m%dT%H%M%S").ok() @@ -40,18 +40,18 @@ fn print_event(event: &ical::parser::ical::component::IcalEvent) { let mut end: Option> = None; let mut summary = String::new(); - for ref p in &event.properties { + for p in &event.properties { match p.name.as_ref() { "DTSTART" => start = parse_datetime(p.value.clone()), "DTEND" => end = parse_datetime(p.value.clone()), - "SUMMARY" => summary = p.value.clone().unwrap_or("".to_string()), + "SUMMARY" => summary = p.value.clone().unwrap_or_else(String::new), _ => (), } } println!("---> {} - {}: {}", - start.unwrap_or(Utc::now()), - end.unwrap_or(Utc::now()), + start.unwrap_or_else(Utc::now), + end.unwrap_or_else(Utc::now), summary); } @@ -71,7 +71,7 @@ fn match_event(event: &ical::parser::ical::component::IcalEvent, pattern: &str) let (key, pat) = (parts[0].to_uppercase(), parts[1]); event.properties.iter() - .filter(|ref p| p.name == key && &p.value.clone().unwrap().matches(&pat).count() > &0) + .filter(|ref p| p.name == key && p.value.clone().unwrap().matches(&pat).count() > 0) .count() > 0 } } -- cgit v1.2.3