[Auto] lib/domain/diary: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
1e47f91a67
commit
777c9e59f1
4 changed files with 12 additions and 13 deletions
|
@ -68,7 +68,7 @@ impl Diary for Store {
|
|||
let id = DiaryId::new(String::from(diary_name), ndt.year(), ndt.month(), ndt.day(), 0, 0, 0);
|
||||
|
||||
let mut entry = self.retrieve(id)?;
|
||||
let _ = entry.set_isflag::<IsDiaryEntry>()?;
|
||||
entry.set_isflag::<IsDiaryEntry>()?;
|
||||
Ok(entry)
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ impl Diary for Store {
|
|||
ndt.second());
|
||||
|
||||
let mut entry = self.retrieve(id)?;
|
||||
let _ = entry.set_isflag::<IsDiaryEntry>()?;
|
||||
entry.set_isflag::<IsDiaryEntry>()?;
|
||||
Ok(entry)
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,6 @@ impl Diary for Store {
|
|||
},
|
||||
}
|
||||
})
|
||||
.into_iter()
|
||||
.rev()
|
||||
.next()
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ impl DiaryId {
|
|||
|
||||
pub fn new(name: String, y: i32, m: u32, d: u32, h: u32, min: u32, sec: u32) -> DiaryId {
|
||||
DiaryId {
|
||||
name: name,
|
||||
name,
|
||||
year: y,
|
||||
month: m,
|
||||
day: d,
|
||||
|
@ -202,7 +202,7 @@ fn component_to_str<'a>(com: Component<'a>) -> Result<&'a str> {
|
|||
Component::Normal(s) => Some(s),
|
||||
_ => None,
|
||||
}.and_then(|s| s.to_str())
|
||||
.ok_or_else(|| Error::from(err_msg("ID Parse error")))
|
||||
.ok_or_else(|| err_msg("ID Parse error"))
|
||||
}
|
||||
|
||||
impl FromStoreId for DiaryId {
|
||||
|
@ -215,7 +215,7 @@ impl FromStoreId for DiaryId {
|
|||
|
||||
fn next_component<'a>(components: &'a mut Rev<Components>) -> Result<&'a str> {
|
||||
components.next()
|
||||
.ok_or_else(|| Error::from(err_msg("ID parse error")))
|
||||
.ok_or_else(|| err_msg("ID parse error"))
|
||||
.and_then(component_to_str)
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ impl FromStoreId for DiaryId {
|
|||
trace!("Found components: {:?}", cmps);
|
||||
|
||||
let (hour, minute, second) = next_component(&mut cmps).and_then(|time| {
|
||||
let mut time = time.split(":");
|
||||
let mut time = time.split(':');
|
||||
let hour = time.next().and_then(|s| FromStr::from_str(s).ok());
|
||||
let minute = time.next().and_then(|s| FromStr::from_str(s).ok());
|
||||
let second = time.next().and_then(|s| FromStr::from_str(s).ok());
|
||||
|
@ -235,7 +235,7 @@ impl FromStoreId for DiaryId {
|
|||
|
||||
match (hour, minute, second) {
|
||||
(Some(h), Some(m), Some(s)) => Ok((h, m, s)),
|
||||
_ => return Err(Error::from(err_msg("ID Parse error"))),
|
||||
_ => Err(err_msg("ID Parse error")),
|
||||
}
|
||||
})?;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ use libimagstore::storeid::StoreId;
|
|||
|
||||
use crate::is_in_diary::IsInDiary;
|
||||
use failure::Fallible as Result;
|
||||
use failure::Error;
|
||||
|
||||
use failure::err_msg;
|
||||
|
||||
/// A iterator for iterating over diary entries
|
||||
|
@ -54,7 +54,7 @@ impl DiaryEntryIterator {
|
|||
pub fn new(diaryname: String, iter: StoreIdIterator) -> DiaryEntryIterator {
|
||||
DiaryEntryIterator {
|
||||
name: diaryname,
|
||||
iter: iter,
|
||||
iter,
|
||||
|
||||
year: None,
|
||||
month: None,
|
||||
|
@ -149,8 +149,8 @@ impl Iterator for DiaryNameIterator {
|
|||
.and_then(|s| {
|
||||
s.split("diary/")
|
||||
.nth(1)
|
||||
.and_then(|n| n.split("/").nth(0).map(String::from))
|
||||
.ok_or_else(|| Error::from(err_msg("Error finding diary name")))
|
||||
.and_then(|n| n.split('/').nth(0).map(String::from))
|
||||
.ok_or_else(|| err_msg("Error finding diary name"))
|
||||
}));
|
||||
},
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ impl Viewer for DiaryViewer {
|
|||
|
||||
for (id, entry) in entries.into_iter() {
|
||||
writeln!(sink, "{} :\n", id)?;
|
||||
let _ = self.0.view_entry(entry.deref(), sink)?;
|
||||
self.0.view_entry(entry.deref(), sink)?;
|
||||
writeln!(sink, "\n---\n")?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue