~matthiasbeyer/imag

f175d3db17125104b6349cd1c8986ea9913e137a — flip1995 2 years ago 7c1a8a5
[Auto] lib/entry/category: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
M lib/entry/libimagentrycategory/src/category.rs => lib/entry/libimagentrycategory/src/category.rs +1 -1
@@ 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>> {

M lib/entry/libimagentrycategory/src/entry.rs => lib/entry/libimagentrycategory/src/entry.rs +4 -4
@@ 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> {

M lib/entry/libimagentrycategory/src/iter.rs => lib/entry/libimagentrycategory/src/iter.rs +1 -1
@@ 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))
                    };


M lib/entry/libimagentrycategory/src/store.rs => lib/entry/libimagentrycategory/src/store.rs +3 -3
@@ 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)?;
            }
        }