[Auto] bin/core/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:44:03 +02:00 committed by Matthias Beyer
parent e0e4d4e720
commit f7f95a651f
10 changed files with 19 additions and 20 deletions

View File

@ -67,7 +67,6 @@ pub fn cont(rt: &Runtime) -> i32 {
let (k2, _) = *t2;
Ord::cmp(&k1, &k2)
})
.into_iter()
// get the last one, which should be the highest one
.last() // -> Option<_>
@ -88,7 +87,7 @@ pub fn cont(rt: &Runtime) -> i32 {
.map(|_| 0)
.map_err_trace();
let _ = rt.report_touched(tracking.get_location()).unwrap_or_exit();
rt.report_touched(tracking.get_location()).unwrap_or_exit();
val
})

View File

@ -67,7 +67,7 @@ pub fn day(rt: &Runtime) -> i32 {
let tags = cmd
.values_of("tags")
.map(|ts| ts.into_iter().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
@ -104,7 +104,7 @@ pub fn day(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})

View File

@ -66,7 +66,7 @@ pub fn list(rt: &Runtime) -> i32 {
::std::process::exit(1)
},
Some(Err(e)) => {
let e = Error::from(e);
let e = e;
trace_error(&e);
::std::process::exit(1)
}
@ -197,7 +197,7 @@ pub fn list_impl(rt: &Runtime,
.collect();
tab.add_row(Row::new(cells));
let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
rt.report_touched(e.get_location()).unwrap_or_exit();
table_empty = false;
Ok(tab)

View File

@ -82,7 +82,7 @@ pub fn month(rt: &Runtime) -> i32 {
let tags = cmd
.values_of("tags")
.map(|ts| ts.into_iter().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
@ -119,7 +119,7 @@ pub fn month(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})

View File

@ -57,7 +57,7 @@ pub fn shell(rt: &Runtime) -> i32 {
mkshell(s.to_owned())
} else {
env::var("SHELL")
.map(|s| mkshell(s))
.map(mkshell)
.map_err(|e| match e {
env::VarError::NotPresent => {
error!("No $SHELL variable in environment, cannot work!");
@ -76,7 +76,7 @@ pub fn shell(rt: &Runtime) -> i32 {
match rt.store().create_timetracking_at(&start, tag) {
Err(e) => trace_error(&e),
Ok(entry) => {
let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
rt.report_touched(entry.get_location()).unwrap_or_exit();
}
}
}
@ -101,7 +101,7 @@ pub fn shell(rt: &Runtime) -> i32 {
trace_error(&e)
} else {
debug!("Setting end time worked: {:?}", elem);
let _ = rt.report_touched(elem.get_location()).unwrap_or_exit();
rt.report_touched(elem.get_location()).unwrap_or_exit();
});
::std::process::exit(exit_code)

View File

@ -59,7 +59,7 @@ pub fn start(rt: &Runtime) -> i32 {
1
},
Ok(entry) => {
let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
rt.report_touched(entry.get_location()).unwrap_or_exit();
acc
}

View File

@ -99,7 +99,7 @@ pub fn stop(rt: &Runtime) -> i32 {
}
Ok(_) => {
debug!("Setting end time worked: {:?}", elem);
let _ = rt.report_touched(elem.get_location()).unwrap_or_exit();
rt.report_touched(elem.get_location()).unwrap_or_exit();
acc
}
}

View File

@ -30,8 +30,8 @@ use libimagerror::exit::ExitUnwrap;
use libimagtimetrack::tag::TimeTrackingTag;
use libimagtimetrack::store::TimeTrackStore;
const DATE_TIME_PARSE_FMT : &'static str = "%Y-%m-%dT%H:%M:%S";
const DATE_PARSE_FMT : &'static str = "%Y-%m-%d";
const DATE_TIME_PARSE_FMT : &str = "%Y-%m-%dT%H:%M:%S";
const DATE_PARSE_FMT : &str = "%Y-%m-%d";
pub fn track(rt: &Runtime) -> i32 {
let (_, cmd) = rt.cli().subcommand();
@ -87,7 +87,7 @@ pub fn track(rt: &Runtime) -> i32 {
1
},
Ok(entry) => {
let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
rt.report_touched(entry.get_location()).unwrap_or_exit();
acc
}
})

View File

@ -80,7 +80,7 @@ pub fn week(rt: &Runtime) -> i32 {
let tags = cmd
.values_of("tags")
.map(|ts| ts.into_iter().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
@ -117,7 +117,7 @@ pub fn week(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})

View File

@ -79,7 +79,7 @@ pub fn year(rt: &Runtime) -> i32 {
let tags = cmd
.values_of("tags")
.map(|ts| ts.into_iter().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
@ -117,7 +117,7 @@ pub fn year(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end);
let _ = rt.report_touched(e.get_location()).unwrap_or_exit();
rt.report_touched(e.get_location()).unwrap_or_exit();
Ok((tag, start, end))
})