[No-auto] bin/domain/timetrack: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:15:26 +02:00 committed by Matthias Beyer
parent 4529ebf216
commit daddea7adf
6 changed files with 9 additions and 15 deletions

View file

@ -67,7 +67,7 @@ pub fn day(rt: &Runtime) -> i32 {
let tags = cmd let tags = cmd
.values_of("tags") .values_of("tags")
.map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::<Vec<_>>());
let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt
@ -78,7 +78,7 @@ pub fn day(rt: &Runtime) -> i32 {
}); });
let tags_filter = move |fle: &FileLockEntry| { let tags_filter = move |fle: &FileLockEntry| {
match tags { match &tags {
Some(ref tags) => has_one_of_tags(&tags).filter(fle), Some(ref tags) => has_one_of_tags(&tags).filter(fle),
None => true, None => true,
} }

View file

@ -53,7 +53,7 @@ pub fn list(rt: &Runtime) -> i32 {
::std::process::exit(1) ::std::process::exit(1)
}); });
Some(dt.clone()) Some(*dt)
}, },
Err(e) => { Err(e) => {
error!("Failed to calculate date from '{}': {:?}", error!("Failed to calculate date from '{}': {:?}",

View file

@ -82,7 +82,7 @@ pub fn month(rt: &Runtime) -> i32 {
let tags = cmd let tags = cmd
.values_of("tags") .values_of("tags")
.map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::<Vec<_>>());
let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt

View file

@ -60,17 +60,11 @@ pub fn stop(rt: &Runtime) -> i32 {
.get_timetrackings() .get_timetrackings()
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
.trace_unwrap() .trace_unwrap()
.filter_map(|tracking| { .filter(|tracking| {
let is_none = tracking tracking
.get_end_datetime() .get_end_datetime()
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
.is_none(); .is_none()
if is_none {
Some(tracking)
} else {
None
}
}) })
.map(|t| t.get_timetrack_tag()) .map(|t| t.get_timetrack_tag())
.map(|r| r.map_err_trace_exit_unwrap()) .map(|r| r.map_err_trace_exit_unwrap())

View file

@ -80,7 +80,7 @@ pub fn week(rt: &Runtime) -> i32 {
let tags = cmd let tags = cmd
.values_of("tags") .values_of("tags")
.map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::<Vec<_>>());
let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt

View file

@ -79,7 +79,7 @@ pub fn year(rt: &Runtime) -> i32 {
let tags = cmd let tags = cmd
.values_of("tags") .values_of("tags")
.map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect()); .map(|ts| ts.map(String::from).map(TimeTrackingTag::from).collect::<Vec<_>>());
let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt