summaryrefslogtreecommitdiffstats
path: root/libimagcounter
diff options
context:
space:
mode:
authorAndre Bogus <bogusandre@gmail.com>2016-05-03 00:57:41 +0200
committerAndre Bogus <bogusandre@gmail.com>2016-05-13 22:26:48 +0200
commitdfd6a9b0d370b841d6591e0d292bc5c7fa2fe76f (patch)
tree6cb460272b335f5a2f933ca519878ad9d8fd9098 /libimagcounter
parent0c89fafe209505acd72f787bda16bcdb9a249457 (diff)
style adaptations
these were introduced following suggestions from https://crates.io/crate/clippy
Diffstat (limited to 'libimagcounter')
-rw-r--r--libimagcounter/src/counter.rs4
-rw-r--r--libimagcounter/src/error.rs17
2 files changed, 10 insertions, 11 deletions
diff --git a/libimagcounter/src/counter.rs b/libimagcounter/src/counter.rs
index 2285071f..a93046f7 100644
--- a/libimagcounter/src/counter.rs
+++ b/libimagcounter/src/counter.rs
@@ -144,12 +144,12 @@ impl<'a> Counter<'a> {
}
trait FromStoreId {
- fn from_storeid<'a>(&'a Store, StoreId) -> Result<Counter<'a>>;
+ fn from_storeid(&Store, StoreId) -> Result<Counter>;
}
impl<'a> FromStoreId for Counter<'a> {
- fn from_storeid<'b>(store: &'b Store, id: StoreId) -> Result<Counter<'b>> {
+ fn from_storeid(store: &Store, id: StoreId) -> Result<Counter> {
debug!("Loading counter from storeid: '{:?}'", id);
match store.retrieve(id) {
Err(e) => Err(CE::new(CEK::StoreReadError, Some(Box::new(e)))),
diff --git a/libimagcounter/src/error.rs b/libimagcounter/src/error.rs
index f1c842f7..1aa347a6 100644
--- a/libimagcounter/src/error.rs
+++ b/libimagcounter/src/error.rs
@@ -1,6 +1,5 @@
use std::error::Error;
use std::fmt::Error as FmtError;
-use std::clone::Clone;
use std::fmt::{Display, Formatter};
/**
@@ -15,11 +14,11 @@ pub enum CounterErrorKind {
}
fn counter_error_type_as_str(e: &CounterErrorKind) -> &'static str {
- match e {
- &CounterErrorKind::StoreReadError => "Store read error",
- &CounterErrorKind::StoreWriteError => "Store write error",
- &CounterErrorKind::HeaderTypeError => "Header type error",
- &CounterErrorKind::HeaderFieldMissingError => "Header field missing error",
+ match *e {
+ CounterErrorKind::StoreReadError => "Store read error",
+ CounterErrorKind::StoreWriteError => "Store write error",
+ CounterErrorKind::HeaderTypeError => "Header type error",
+ CounterErrorKind::HeaderFieldMissingError => "Header field missing error",
}
}
@@ -59,7 +58,7 @@ impl CounterError {
* Get the error type of this CounterError
*/
pub fn err_type(&self) -> CounterErrorKind {
- self.err_type.clone()
+ self.err_type
}
}
@@ -67,7 +66,7 @@ impl CounterError {
impl Display for CounterError {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
- try!(write!(fmt, "[{}]", counter_error_type_as_str(&self.err_type.clone())));
+ try!(write!(fmt, "[{}]", counter_error_type_as_str(&self.err_type)));
Ok(())
}
@@ -76,7 +75,7 @@ impl Display for CounterError {
impl Error for CounterError {
fn description(&self) -> &str {
- counter_error_type_as_str(&self.err_type.clone())
+ counter_error_type_as_str(&self.err_type)
}
fn cause(&self) -> Option<&Error> {