diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-11-07 17:30:46 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-11-09 21:48:02 +0100 |
commit | ed469f622a2f0f2f478ad0689415d465f028de1c (patch) | |
tree | 156a0dfafc5bc802f406b08f6bf8afb11ebc7a65 /lib | |
parent | 8d0ae1058ed2ae8627d8b0b109ca4b2fb1a62ed9 (diff) |
Make code more idomatic
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/domain/libimagtimetrack/src/iter/setendtime.rs | 20 | ||||
-rw-r--r-- | lib/domain/libimagtimetrack/src/iter/storeid.rs | 18 |
2 files changed, 15 insertions, 23 deletions
diff --git a/lib/domain/libimagtimetrack/src/iter/setendtime.rs b/lib/domain/libimagtimetrack/src/iter/setendtime.rs index 3d2e4ca1..60040159 100644 --- a/lib/domain/libimagtimetrack/src/iter/setendtime.rs +++ b/lib/domain/libimagtimetrack/src/iter/setendtime.rs @@ -32,13 +32,9 @@ pub struct SetEndTimeIter<'a> { datetime: NDT, } -impl<'a> SetEndTimeIter<'a> -{ +impl<'a> SetEndTimeIter<'a> { pub fn new(inner: CreateTimeTrackIter<'a>, datetime: NDT) -> SetEndTimeIter<'a> { - SetEndTimeIter { - inner: inner, - datetime: datetime, - } + SetEndTimeIter { inner, datetime } } } @@ -48,13 +44,11 @@ impl<'a> Iterator for SetEndTimeIter<'a> { fn next(&mut self) -> Option<Self::Item> { self.inner .next() - .map(|res| { - res.and_then(|mut fle| { - let v = Value::String(self.datetime.format(DATE_TIME_FORMAT).to_string()); - let _ = fle.get_header_mut().insert(DATE_TIME_END_HEADER_PATH, v)?; - Ok(fle) - }) - }) + .map(|res| res.and_then(|mut fle| { + let v = Value::String(self.datetime.format(DATE_TIME_FORMAT).to_string()); + let _ = fle.get_header_mut().insert(DATE_TIME_END_HEADER_PATH, v)?; + Ok(fle) + })) } } diff --git a/lib/domain/libimagtimetrack/src/iter/storeid.rs b/lib/domain/libimagtimetrack/src/iter/storeid.rs index 91656a3f..63728ad2 100644 --- a/lib/domain/libimagtimetrack/src/iter/storeid.rs +++ b/lib/domain/libimagtimetrack/src/iter/storeid.rs @@ -57,16 +57,14 @@ impl Iterator for TagStoreIdIter { self.inner .next() - .map(|res| { - res.and_then(|tag| { - let dt = self.datetime.format(DATE_TIME_FORMAT).to_string(); - let id_str = format!("{}-{}", dt, tag.as_str()); - ModuleEntryPath::new(id_str) - .into_storeid() - .map_err(Error::from) - .map(|id| (id, self.datetime.clone())) - }) - }) + .map(|res| res.and_then(|tag| { + let dt = self.datetime.format(DATE_TIME_FORMAT).to_string(); + let id_str = format!("{}-{}", dt, tag.as_str()); + ModuleEntryPath::new(id_str) + .into_storeid() + .map_err(Error::from) + .map(|id| (id, self.datetime.clone())) + })) } } |