Merge pull request #351 from matthiasbeyer/libimagcounter/zero-warnings

Libimagcounter/zero warnings
This commit is contained in:
Matthias Beyer 2016-04-16 22:02:05 +02:00
commit f003625257
3 changed files with 18 additions and 13 deletions

View file

@ -1,7 +1,4 @@
use std::convert::From;
use std::convert::Into;
use std::ops::DerefMut; use std::ops::DerefMut;
use std::ops::Deref;
use toml::Value; use toml::Value;
@ -11,8 +8,6 @@ use libimagstore::store::Store;
use libimagstore::storeid::StoreIdIterator; use libimagstore::storeid::StoreIdIterator;
use libimagstore::store::FileLockEntry; use libimagstore::store::FileLockEntry;
use libimagstore::storeid::StoreId; use libimagstore::storeid::StoreId;
use libimagstore::error::StoreError;
use libimagstore::store::Entry;
use libimagstore::storeid::IntoStoreId; use libimagstore::storeid::IntoStoreId;
use module_path::ModuleEntryPath; use module_path::ModuleEntryPath;
@ -33,7 +28,7 @@ impl<'a> Counter<'a> {
debug!("Creating new counter: '{}' with value: {}", name, init); debug!("Creating new counter: '{}' with value: {}", name, init);
let fle = { 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() { if lockentry.is_err() {
return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.err().unwrap())))); return Err(CE::new(CEK::StoreWriteError, Some(Box::new(lockentry.err().unwrap()))));
} }
@ -105,8 +100,7 @@ impl<'a> Counter<'a> {
} }
pub fn name(&self) -> Result<CounterName> { pub fn name(&self) -> Result<CounterName> {
let mut header = self.fle.deref().get_header(); self.fle.get_header().read("counter.name")
header.read("counter.name")
.map_err(|e| CE::new(CEK::StoreWriteError, Some(Box::new(e)))) .map_err(|e| CE::new(CEK::StoreWriteError, Some(Box::new(e))))
.and_then(|v| { .and_then(|v| {
match v { match v {
@ -117,8 +111,7 @@ impl<'a> Counter<'a> {
} }
pub fn value(&self) -> Result<i64> { pub fn value(&self) -> Result<i64> {
let mut header = self.fle.deref().get_header(); self.fle.get_header().read("counter.value")
header.read("counter.value")
.map_err(|e| CE::new(CEK::StoreWriteError, Some(Box::new(e)))) .map_err(|e| CE::new(CEK::StoreWriteError, Some(Box::new(e))))
.and_then(|v| { .and_then(|v| {
match v { match v {

View file

@ -1,9 +1,7 @@
use std::error::Error; use std::error::Error;
use std::fmt::Error as FmtError; use std::fmt::Error as FmtError;
use std::clone::Clone; use std::clone::Clone;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Display, Formatter};
use std::fmt;
use std::convert::From;
/** /**
* Kind of error * Kind of error

View file

@ -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; extern crate toml;
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[macro_use] extern crate semver; #[macro_use] extern crate semver;