diff options
Diffstat (limited to 'src/icalendar.rs')
-rw-r--r-- | src/icalendar.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/icalendar.rs b/src/icalendar.rs index ba2c3cf..c49e193 100644 --- a/src/icalendar.rs +++ b/src/icalendar.rs @@ -25,11 +25,7 @@ impl ICalendar { /// pub fn build(s: &str) -> Result<ICalendar> { let c = parse_component(s)?; - Self::from_component(c) - .map_err(|_| { - let kind = VObjectErrorKind::NotAnICalendar(s.to_owned()); - VObjectError::from_kind(kind) - }) + Self::from_component(c).map_err(|_| VObjectErrorKind::NotAnICalendar(s.to_owned())) } pub fn empty() -> ICalendar { @@ -175,7 +171,7 @@ impl AsDateTime for Dtend { Ok(dt) => Ok(Time::DateTime(dt)), Err(_) => NaiveDate::parse_from_str(&self.0, DATE_FMT) .map(Time::Date) - .map_err(From::from), + .map_err(VObjectErrorKind::ChronoError), } } @@ -189,7 +185,7 @@ impl AsDateTime for Dtstart { Ok(dt) => Ok(Time::DateTime(dt)), Err(_) => NaiveDate::parse_from_str(&self.0, DATE_FMT) .map(Time::Date) - .map_err(From::from), + .map_err(VObjectErrorKind::ChronoError), } } @@ -203,7 +199,7 @@ impl AsDateTime for Dtstamp { Ok(dt) => Ok(Time::DateTime(dt)), Err(_) => NaiveDate::parse_from_str(&self.0, DATE_FMT) .map(Time::Date) - .map_err(From::from), + .map_err(VObjectErrorKind::ChronoError), } } |