[Auto] lib/entry/category: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
7c1a8a542c
commit
f175d3db17
4 changed files with 9 additions and 9 deletions
|
@ -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<CategoryEntryIterator<'a>> {
|
||||
|
|
|
@ -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<bool> {
|
||||
|
|
|
@ -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))
|
||||
};
|
||||
|
||||
|
|
|
@ -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)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue