summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2019-08-27 10:46:01 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-08-28 18:18:40 +0200
commit777c9e59f142cb89f69bc8a2ecdeaad88ff44708 (patch)
treee49b395f21c873523ab60833f86e00db00d4ffc5
parent1e47f91a67937ef7f58754746891359a7ba42ce9 (diff)
downloadimag-777c9e59f142cb89f69bc8a2ecdeaad88ff44708.zip
imag-777c9e59f142cb89f69bc8a2ecdeaad88ff44708.tar.gz
[Auto] lib/domain/diary: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--lib/domain/libimagdiary/src/diary.rs5
-rw-r--r--lib/domain/libimagdiary/src/diaryid.rs10
-rw-r--r--lib/domain/libimagdiary/src/iter.rs8
-rw-r--r--lib/domain/libimagdiary/src/viewer.rs2
4 files changed, 12 insertions, 13 deletions
diff --git a/lib/domain/libimagdiary/src/diary.rs b/lib/domain/libimagdiary/src/diary.rs
index b268b0b..17bfdbe 100644
--- a/lib/domain/libimagdiary/src/diary.rs
+++ b/lib/domain/libimagdiary/src/diary.rs
@@ -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()
}
diff --git a/lib/domain/libimagdiary/src/diaryid.rs b/lib/domain/libimagdiary/src/diaryid.rs
index 727bb52..c842a15 100644
--- a/lib/domain/libimagdiary/src/diaryid.rs
+++ b/lib/domain/libimagdiary/src/diaryid.rs
@@ -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")),
}
})?;
diff --git a/lib/domain/libimagdiary/src/iter.rs b/lib/domain/libimagdiary/src/iter.rs
index 147aaf6..38850ce 100644
--- a/lib/domain/libimagdiary/src/iter.rs
+++ b/lib/domain/libimagdiary/src/iter.rs
@@ -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"))
}));
},
}
diff --git a/lib/domain/libimagdiary/src/viewer.rs b/lib/domain/libimagdiary/src/viewer.rs
index f440766..fccec42 100644
--- a/lib/domain/libimagdiary/src/viewer.rs
+++ b/lib/domain/libimagdiary/src/viewer.rs
@@ -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")?;
}