From 5cc84c1551a275fd97aea8a587cb88e31c6c1a96 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 31 Jul 2016 10:38:21 +0200 Subject: [PATCH 1/5] Remove keyword: mut --- imag-diary/src/create.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imag-diary/src/create.rs b/imag-diary/src/create.rs index 0fb46cb9..c7f744a4 100644 --- a/imag-diary/src/create.rs +++ b/imag-diary/src/create.rs @@ -34,7 +34,7 @@ pub fn create(rt: &Runtime) { let id = match create.value_of("timed") { Some("h") | Some("hourly") => { debug!("Creating hourly-timed entry"); - let mut time = DiaryId::now(String::from(diary.name())); + let time = DiaryId::now(String::from(diary.name())); let hr = create .value_of("hour") .map(|v| { debug!("Creating hourly entry with hour = {:?}", v); v }) From c1d41c954e0b03ae4795992ddff38f3458d3f938 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 31 Jul 2016 10:38:30 +0200 Subject: [PATCH 2/5] Remove keyword: mut --- imag-diary/src/create.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imag-diary/src/create.rs b/imag-diary/src/create.rs index c7f744a4..5777ef6a 100644 --- a/imag-diary/src/create.rs +++ b/imag-diary/src/create.rs @@ -50,7 +50,7 @@ pub fn create(rt: &Runtime) { Some("m") | Some("minutely") => { debug!("Creating minutely-timed entry"); - let mut time = DiaryId::now(String::from(diary.name())); + let time = DiaryId::now(String::from(diary.name())); let hr = create .value_of("hour") .map(|h| { debug!("hour = {:?}", h); h }) From 7187ad89b1a2c853ca7937c9774c0794198db282 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 31 Jul 2016 10:39:43 +0200 Subject: [PATCH 3/5] If an error happens while viewing, trace it --- imag-diary/src/view.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imag-diary/src/view.rs b/imag-diary/src/view.rs index 0d0f5317..e96e0649 100644 --- a/imag-diary/src/view.rs +++ b/imag-diary/src/view.rs @@ -24,7 +24,9 @@ pub fn view(rt: &Runtime) { for entry in entries.into_iter().filter_map(Result::ok) { let id = entry.diary_id(); println!("{} :\n", id); - pv.view_entry(&entry); + if let Err(e) = pv.view_entry(&entry) { + trace_error(&e); + }; println!("\n---\n"); } }, From b613aba2576923c09db00d8e09f1048f1171a127 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 31 Jul 2016 11:11:06 +0200 Subject: [PATCH 4/5] Remove unused function We do not offer explicit diary functionality. Either a user creates a diary implicitely by creating a new entry inside of it, or not. --- imag-diary/src/main.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/imag-diary/src/main.rs b/imag-diary/src/main.rs index 647a9b25..83572f5a 100644 --- a/imag-diary/src/main.rs +++ b/imag-diary/src/main.rs @@ -57,7 +57,6 @@ fn main() { "delete" => delete(&rt), "edit" => edit(&rt), "list" => list(&rt), - "diary" => diary(&rt), "view" => view(&rt), _ => { debug!("Unknown command"); // More error handling @@ -66,7 +65,3 @@ fn main() { }); } -fn diary(rt: &Runtime) { - unimplemented!() -} - From dcd72765bc9754b06a6ee5b20a9ce850a9868f4b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 31 Jul 2016 11:12:35 +0200 Subject: [PATCH 5/5] Add deny() macro --- imag-diary/src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/imag-diary/src/main.rs b/imag-diary/src/main.rs index 83572f5a..c65780a8 100644 --- a/imag-diary/src/main.rs +++ b/imag-diary/src/main.rs @@ -1,3 +1,18 @@ +#![deny( + non_camel_case_types, + non_snake_case, + path_statements, + trivial_numeric_casts, + unstable_features, + unused_allocation, + unused_import_braces, + unused_imports, + unused_must_use, + unused_mut, + unused_qualifications, + while_true, +)] + #[macro_use] extern crate log; #[macro_use] extern crate version; extern crate clap;