From 75fbcef4aadf1293195cf6dd1eea7672d2191c58 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 21 Apr 2016 13:31:29 +0200 Subject: [PATCH 1/4] Use unused results --- imag-store/src/create.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/imag-store/src/create.rs b/imag-store/src/create.rs index 9d90f642..9921bb05 100644 --- a/imag-store/src/create.rs +++ b/imag-store/src/create.rs @@ -32,7 +32,7 @@ pub fn create(rt: &Runtime) { let path = scmd.value_of("path").or_else(|| scmd.value_of("id")); if path.is_none() { warn!("No ID / Path provided. Exiting now"); - write!(stderr(), "No ID / Path provided. Exiting now"); + write!(stderr(), "No ID / Path provided. Exiting now").ok(); exit(1); } @@ -101,14 +101,15 @@ fn create_from_source(rt: &Runtime, matches: &ArgMatches, path: &PathBuf) -> Res debug!("Content with len = {}", content.len()); Entry::from_str(path.clone(), &content[..]) - .map(|mut new_e| { - rt.store() + .and_then(|new_e| { + let r = rt.store() .create(path.clone()) .map(|mut old_e| { *old_e.deref_mut() = new_e; }); debug!("Entry build"); + r }) .map_err(|serr| StoreError::new(StoreErrorKind::BackendError, Some(Box::new(serr)))) } @@ -144,7 +145,7 @@ fn string_from_raw_src(raw_src: &str) -> String { debug!("Read {:?} bytes", res); } else { debug!("Reading entry from file at {:?}", raw_src); - OpenOptions::new() + let _ = OpenOptions::new() .read(true) .write(false) .create(false) From 73c844ceb1ab531aae8622f9299cb46e4c6ab12b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 21 Apr 2016 13:31:42 +0200 Subject: [PATCH 2/4] Remove unused imports --- imag-store/src/delete.rs | 2 -- imag-store/src/retrieve.rs | 2 -- imag-store/src/update.rs | 1 - imag-store/src/util.rs | 3 --- 4 files changed, 8 deletions(-) diff --git a/imag-store/src/delete.rs b/imag-store/src/delete.rs index 71bf0f91..5386903e 100644 --- a/imag-store/src/delete.rs +++ b/imag-store/src/delete.rs @@ -1,5 +1,3 @@ -use std::path::PathBuf; - use libimagstore::storeid::build_entry_path; use libimagrt::runtime::Runtime; use libimagutil::trace::trace_error; diff --git a/imag-store/src/retrieve.rs b/imag-store/src/retrieve.rs index cc43ece2..0a49b164 100644 --- a/imag-store/src/retrieve.rs +++ b/imag-store/src/retrieve.rs @@ -1,6 +1,4 @@ -use std::path::PathBuf; use std::ops::Deref; -use std::fmt::Display; use std::process::exit; use clap::ArgMatches; diff --git a/imag-store/src/update.rs b/imag-store/src/update.rs index d37da1c2..287624c5 100644 --- a/imag-store/src/update.rs +++ b/imag-store/src/update.rs @@ -1,4 +1,3 @@ -use std::path::PathBuf; use std::ops::DerefMut; use std::process::exit; diff --git a/imag-store/src/util.rs b/imag-store/src/util.rs index 61832e3a..27c8a9a0 100644 --- a/imag-store/src/util.rs +++ b/imag-store/src/util.rs @@ -1,13 +1,10 @@ use std::collections::BTreeMap; -use std::path::PathBuf; use std::str::Split; use clap::ArgMatches; -use semver::Version; use toml::Value; use libimagstore::store::EntryHeader; -use libimagrt::runtime::Runtime; use libimagutil::key_value_split::IntoKeyValue; pub fn build_toml_header(matches: &ArgMatches, mut header: EntryHeader) -> EntryHeader { From 713151af79c89378dfd64b16d0784a5c91066c6c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 21 Apr 2016 13:31:53 +0200 Subject: [PATCH 3/4] Remove unneeded keyword "mut" --- imag-store/src/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imag-store/src/util.rs b/imag-store/src/util.rs index 27c8a9a0..f14d462b 100644 --- a/imag-store/src/util.rs +++ b/imag-store/src/util.rs @@ -7,7 +7,7 @@ use toml::Value; use libimagstore::store::EntryHeader; use libimagutil::key_value_split::IntoKeyValue; -pub fn build_toml_header(matches: &ArgMatches, mut header: EntryHeader) -> EntryHeader { +pub fn build_toml_header(matches: &ArgMatches, header: EntryHeader) -> EntryHeader { debug!("Building header from cli spec"); if let Some(headerspecs) = matches.values_of("header") { let mut main = header.into(); From bcc7554389fd6532561a9c714189f9872c30cd3d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 21 Apr 2016 13:27:05 +0200 Subject: [PATCH 4/4] Enable lints --- imag-store/src/main.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/imag-store/src/main.rs b/imag-store/src/main.rs index 4b5968d7..679390e3 100644 --- a/imag-store/src/main.rs +++ b/imag-store/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, +)] + extern crate clap; #[macro_use] extern crate log; extern crate semver;