From f175d3db17125104b6349cd1c8986ea9913e137a Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 10:48:33 +0200 Subject: [PATCH] [Auto] lib/entry/category: Fix Clippy warnings Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- lib/entry/libimagentrycategory/src/category.rs | 2 +- lib/entry/libimagentrycategory/src/entry.rs | 8 ++++---- lib/entry/libimagentrycategory/src/iter.rs | 2 +- lib/entry/libimagentrycategory/src/store.rs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/entry/libimagentrycategory/src/category.rs b/lib/entry/libimagentrycategory/src/category.rs index ea2fbf90..4bc52010 100644 --- a/lib/entry/libimagentrycategory/src/category.rs +++ b/lib/entry/libimagentrycategory/src/category.rs @@ -52,7 +52,7 @@ impl Category for Entry { .read_string(CATEGORY_REGISTER_NAME_FIELD_PATH) .context(format_err!("Failed to read header at '{}'", CATEGORY_REGISTER_NAME_FIELD_PATH)) .map_err(Error::from)? - .ok_or_else(|| Error::from(err_msg("Category name missing"))) + .ok_or_else(|| err_msg("Category name missing")) } fn get_entries<'a>(&self, store: &'a Store) -> Result> { diff --git a/lib/entry/libimagentrycategory/src/entry.rs b/lib/entry/libimagentrycategory/src/entry.rs index 9d0e06ba..8ea7a4d1 100644 --- a/lib/entry/libimagentrycategory/src/entry.rs +++ b/lib/entry/libimagentrycategory/src/entry.rs @@ -65,10 +65,10 @@ impl EntryCategory for Entry { trace!("Setting category '{}' checked", s); let mut category = register .get_category_by_name(s)? - .ok_or_else(|| Error::from(err_msg("Category does not exist")))?; + .ok_or_else(|| err_msg("Category does not exist"))?; - let _ = self.set_category(s)?; - let _ = self.add_link(&mut category)?; + self.set_category(s)?; + self.add_link(&mut category)?; Ok(()) } @@ -77,7 +77,7 @@ impl EntryCategory for Entry { trace!("Getting category from '{}'", self.get_location()); self.get_header() .read_string("category.value")? - .ok_or_else(|| Error::from(err_msg("Category name missing"))) + .ok_or_else(|| err_msg("Category name missing")) } fn has_category(&self) -> Result { diff --git a/lib/entry/libimagentrycategory/src/iter.rs b/lib/entry/libimagentrycategory/src/iter.rs index 7ed342c7..99574f6a 100644 --- a/lib/entry/libimagentrycategory/src/iter.rs +++ b/lib/entry/libimagentrycategory/src/iter.rs @@ -103,7 +103,7 @@ impl<'a> Iterator for CategoryEntryIterator<'a> { let getter = |next| -> Result<(String, FileLockEntry<'a>)> { let entry = self.0 .get(next)? - .ok_or_else(|| Error::from(err_msg("Store read error")))?; + .ok_or_else(|| err_msg("Store read error"))?; Ok((entry.get_category()?, entry)) }; diff --git a/lib/entry/libimagentrycategory/src/store.rs b/lib/entry/libimagentrycategory/src/store.rs index 8ef44545..fa8a6c16 100644 --- a/lib/entry/libimagentrycategory/src/store.rs +++ b/lib/entry/libimagentrycategory/src/store.rs @@ -34,7 +34,7 @@ use failure::err_msg; use crate::iter::CategoryNameIter; use crate::category::IsCategory; -pub const CATEGORY_REGISTER_NAME_FIELD_PATH : &'static str = "category.register.name"; +pub const CATEGORY_REGISTER_NAME_FIELD_PATH : &str = "category.register.name"; /// Extension on the Store to make it a register for categories /// @@ -92,12 +92,12 @@ impl CategoryStore for Store { { let mut category = self.get(sid.clone())? - .ok_or_else(|| Error::from(err_msg("Category does not exist"))) + .ok_or_else(|| err_msg("Category does not exist")) .map_err(Error::from)?; for entry in category.get_entries(self)? { let mut entry = entry?; - let _ = category.remove_link(&mut entry)?; + category.remove_link(&mut entry)?; } }