aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-12-18 15:34:23 +0100
committerHarald Eilertsen <haraldei@anduin.net>2018-12-18 15:34:23 +0100
commit7c2454f33cb2b3d6b8005c2ab9c09ff406870b8f (patch)
treee42571aaf4cf80252469d89d447120b075629495
parent20255c86854e628756ff8b71e7be5384dcaac41f (diff)
downloadicaltool-7c2454f33cb2b3d6b8005c2ab9c09ff406870b8f.tar.gz
icaltool-7c2454f33cb2b3d6b8005c2ab9c09ff406870b8f.tar.bz2
icaltool-7c2454f33cb2b3d6b8005c2ab9c09ff406870b8f.zip
Fix clippy issues.
-rw-r--r--src/main.rs12
1 files 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<String>) -> Option<DateTime<Utc>> {
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<DateTime<Utc>> = 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
}
}