diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-03-05 20:18:58 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-03-05 20:18:58 +0100 |
commit | a0bad9c82337ab7dd273a7bd3d2393541aa2cb74 (patch) | |
tree | c6c571da4aae32b18c539a850d7f740b0c3a60b5 /src/parser/iterator.rs | |
parent | 13b22a534c6adc2f6dc6e651c3c69bd878dc6c0f (diff) | |
parent | bc585647159fac0b7d2d4e147b50c44555fa0f79 (diff) |
Merge branch 'thiserror'
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/parser/iterator.rs')
-rw-r--r-- | src/parser/iterator.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/parser/iterator.rs b/src/parser/iterator.rs index a60892e..7d3007c 100644 --- a/src/parser/iterator.rs +++ b/src/parser/iterator.rs @@ -1,12 +1,11 @@ use nom::whitespace::sp; -use failure::Fallible as Result; -use failure::Error; +use error::Result; +use error::Error; use parser::timetype::*; use timetype::IntoTimeType; use timetype; use iter; -use error; named!(pub iter_spec<Iterspec>, alt_complete!( tag!("secondly") => { |_| Iterspec::Secondly } | @@ -91,30 +90,30 @@ impl Iterator { Iterspec::Yearly => unit_to_amount(1, Unit::Year), }; - let into_ndt = |e: timetype::TimeType| try!(e.calculate()) + let into_ndt = |e: timetype::TimeType| e.calculate()? .get_moment() - .ok_or(error::ErrorKind::NotADateInsideIterator) + .ok_or(Error::NotADateInsideIterator) .map_err(Error::from) .map(Clone::clone); match self.2 { Some(UntilSpec::Exact(e)) => { - let base = try!(into_ndt(self.0.into_timetype()?)); - let e = try!(into_ndt(e.into_timetype()?)); + let base = into_ndt(self.0.into_timetype()?)?; + let e = into_ndt(e.into_timetype()?)?; iter::Iter::build(base, recur) .map(|it| UserIterator::UntilIterator(it.until(e))) }, Some(UntilSpec::Times(i)) => { - let base = try!(into_ndt(self.0.into_timetype()?)); + let base = into_ndt(self.0.into_timetype()?)?; iter::Iter::build(base, recur) .map(|it| it.times(i)) .map(UserIterator::TimesIter) }, None => { - let base = try!(into_ndt(self.0.into_timetype()?)); + let base = into_ndt(self.0.into_timetype()?)?; iter::Iter::build(base, recur) .map(UserIterator::Iterator) }, |