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

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.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| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt
@ -104,7 +104,7 @@ pub fn day(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?; let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end); 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)) Ok((tag, start, end))
}) })

View file

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

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.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| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt
@ -119,7 +119,7 @@ pub fn month(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?; let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end); 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)) Ok((tag, start, end))
}) })

View file

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

View file

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

View file

@ -99,7 +99,7 @@ pub fn stop(rt: &Runtime) -> i32 {
} }
Ok(_) => { Ok(_) => {
debug!("Setting end time worked: {:?}", elem); 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 acc
} }
} }

View file

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

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.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| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt
@ -117,7 +117,7 @@ pub fn week(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?; let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end); 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)) Ok((tag, start, end))
}) })

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.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| { let start_time_filter = has_start_time_where(move |dt: &NaiveDateTime| {
start <= *dt start <= *dt
@ -117,7 +117,7 @@ pub fn year(rt: &Runtime) -> i32 {
let end = e.get_end_datetime()?; let end = e.get_end_datetime()?;
debug!(" -> end = {:?}", end); 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)) Ok((tag, start, end))
}) })