aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
}
}