From 1d5ed2c3d57f4590792880c6f628b4920b18b089 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Apr 2016 17:54:38 +0200 Subject: [PATCH 1/3] Remove unused keyword "mut" --- libimagcounter/src/counter.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libimagcounter/src/counter.rs b/libimagcounter/src/counter.rs index 18d5ca30..a0103f5e 100644 --- a/libimagcounter/src/counter.rs +++ b/libimagcounter/src/counter.rs @@ -33,7 +33,7 @@ impl<'a> Counter<'a> { debug!("Creating new counter: '{}' with value: {}", name, init); let fle = { - let mut lockentry = store.create(ModuleEntryPath::new(name.clone()).into_storeid()); + let lockentry = store.create(ModuleEntryPath::new(name.clone()).into_storeid()); if lockentry.is_err() { return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.err().unwrap())))); } @@ -105,8 +105,7 @@ impl<'a> Counter<'a> { } pub fn name(&self) -> Result { - let mut header = self.fle.deref().get_header(); - header.read("counter.name") + self.fle.get_header().read("counter.name") .map_err(|e| CE::new(CEK::StoreWriteError, Some(Box::new(e)))) .and_then(|v| { match v { @@ -117,8 +116,7 @@ impl<'a> Counter<'a> { } pub fn value(&self) -> Result { - let mut header = self.fle.deref().get_header(); - header.read("counter.value") + self.fle.get_header().read("counter.value") .map_err(|e| CE::new(CEK::StoreWriteError, Some(Box::new(e)))) .and_then(|v| { match v { From 0524b26fa76bff71b8903050b932505f2ac43a6b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Apr 2016 17:52:51 +0200 Subject: [PATCH 2/3] Remove unused imports --- libimagcounter/src/counter.rs | 5 ----- libimagcounter/src/error.rs | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/libimagcounter/src/counter.rs b/libimagcounter/src/counter.rs index a0103f5e..bea7537e 100644 --- a/libimagcounter/src/counter.rs +++ b/libimagcounter/src/counter.rs @@ -1,7 +1,4 @@ -use std::convert::From; -use std::convert::Into; use std::ops::DerefMut; -use std::ops::Deref; use toml::Value; @@ -11,8 +8,6 @@ use libimagstore::store::Store; use libimagstore::storeid::StoreIdIterator; use libimagstore::store::FileLockEntry; use libimagstore::storeid::StoreId; -use libimagstore::error::StoreError; -use libimagstore::store::Entry; use libimagstore::storeid::IntoStoreId; use module_path::ModuleEntryPath; diff --git a/libimagcounter/src/error.rs b/libimagcounter/src/error.rs index 78d0cf46..f1c842f7 100644 --- a/libimagcounter/src/error.rs +++ b/libimagcounter/src/error.rs @@ -1,9 +1,7 @@ use std::error::Error; use std::fmt::Error as FmtError; use std::clone::Clone; -use std::fmt::{Debug, Display, Formatter}; -use std::fmt; -use std::convert::From; +use std::fmt::{Display, Formatter}; /** * Kind of error From 7ea6dccd2932eb324774341ab30b8edd65278778 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Apr 2016 17:54:42 +0200 Subject: [PATCH 3/3] Enable lints --- libimagcounter/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libimagcounter/src/lib.rs b/libimagcounter/src/lib.rs index 8b7a333a..77033170 100644 --- a/libimagcounter/src/lib.rs +++ b/libimagcounter/src/lib.rs @@ -1,3 +1,17 @@ +#![deny( + non_camel_case_types, + non_snake_case, + path_statements, + trivial_numeric_casts, + unstable_features, + unused_allocation, + unused_import_braces, + unused_imports, + unused_mut, + unused_qualifications, + while_true, +)] + extern crate toml; #[macro_use] extern crate log; #[macro_use] extern crate semver;