From daddea7adf8514178b492fe424098ef2bb1e7a3a Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 10:15:26 +0200 Subject: [PATCH] [No-auto] bin/domain/timetrack: Fix Clippy warnings Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- bin/domain/imag-timetrack/src/day.rs | 4 ++-- bin/domain/imag-timetrack/src/list.rs | 2 +- bin/domain/imag-timetrack/src/month.rs | 2 +- bin/domain/imag-timetrack/src/stop.rs | 12 +++--------- bin/domain/imag-timetrack/src/week.rs | 2 +- bin/domain/imag-timetrack/src/year.rs | 2 +- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/bin/domain/imag-timetrack/src/day.rs b/bin/domain/imag-timetrack/src/day.rs index 9e7e8ba6..3bcd0990 100644 --- a/bin/domain/imag-timetrack/src/day.rs +++ b/bin/domain/imag-timetrack/src/day.rs @@ -67,7 +67,7 @@ pub fn day(rt: &Runtime) -> i32 { let tags = cmd .values_of("tags") - .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); + .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::>()); let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { start <= *dt @@ -78,7 +78,7 @@ pub fn day(rt: &Runtime) -> i32 { }); let tags_filter = move |fle: &FileLockEntry| { - match tags { + match &tags { Some(ref tags) => has_one_of_tags(&tags).filter(fle), None => true, } diff --git a/bin/domain/imag-timetrack/src/list.rs b/bin/domain/imag-timetrack/src/list.rs index 8a733dd0..c323cf29 100644 --- a/bin/domain/imag-timetrack/src/list.rs +++ b/bin/domain/imag-timetrack/src/list.rs @@ -53,7 +53,7 @@ pub fn list(rt: &Runtime) -> i32 { ::std::process::exit(1) }); - Some(dt.clone()) + Some(*dt) }, Err(e) => { error!("Failed to calculate date from '{}': {:?}", diff --git a/bin/domain/imag-timetrack/src/month.rs b/bin/domain/imag-timetrack/src/month.rs index c6f617b7..19d12ebe 100644 --- a/bin/domain/imag-timetrack/src/month.rs +++ b/bin/domain/imag-timetrack/src/month.rs @@ -82,7 +82,7 @@ pub fn month(rt: &Runtime) -> i32 { let tags = cmd .values_of("tags") - .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); + .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::>()); let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { start <= *dt diff --git a/bin/domain/imag-timetrack/src/stop.rs b/bin/domain/imag-timetrack/src/stop.rs index a7fc1f88..5a7f76a3 100644 --- a/bin/domain/imag-timetrack/src/stop.rs +++ b/bin/domain/imag-timetrack/src/stop.rs @@ -60,17 +60,11 @@ pub fn stop(rt: &Runtime) -> i32 { .get_timetrackings() .map_err_trace_exit_unwrap() .trace_unwrap() - .filter_map(|tracking| { - let is_none = tracking + .filter(|tracking| { + tracking .get_end_datetime() .map_err_trace_exit_unwrap() - .is_none(); - - if is_none { - Some(tracking) - } else { - None - } + .is_none() }) .map(|t| t.get_timetrack_tag()) .map(|r| r.map_err_trace_exit_unwrap()) diff --git a/bin/domain/imag-timetrack/src/week.rs b/bin/domain/imag-timetrack/src/week.rs index 9deb223d..fe9a4d4d 100644 --- a/bin/domain/imag-timetrack/src/week.rs +++ b/bin/domain/imag-timetrack/src/week.rs @@ -80,7 +80,7 @@ pub fn week(rt: &Runtime) -> i32 { let tags = cmd .values_of("tags") - .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); + .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::>()); let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { start <= *dt diff --git a/bin/domain/imag-timetrack/src/year.rs b/bin/domain/imag-timetrack/src/year.rs index 5803b948..d1efaf93 100644 --- a/bin/domain/imag-timetrack/src/year.rs +++ b/bin/domain/imag-timetrack/src/year.rs @@ -79,7 +79,7 @@ pub fn year(rt: &Runtime) -> i32 { let tags = cmd .values_of("tags") - .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); + .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::>()); let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { start <= *dt