Skip to content

Commit

Permalink
added error description for rustc 1.13, and used cfg any std, test
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-kfed committed Feb 25, 2021
1 parent cbff821 commit 38c7f59
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,15 @@ impl fmt::Debug for ParseWeekdayError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ParseWeekdayError {}
#[cfg(any(feature = "std", test))]
impl std::error::Error for ParseWeekdayError {
#[allow(deprecated)]
fn description(&self) -> &str {
"Weekday parser error, see to_string() for details"
}
}

#[cfg(feature = "std")]
#[cfg(any(feature = "std", test))]
impl fmt::Display for ParseWeekdayError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "ParseWeekdayError {{ .. }}")
Expand Down Expand Up @@ -1153,10 +1158,15 @@ impl fmt::Debug for ParseMonthError {
}
}

#[cfg(feature = "std")]
impl std::error::Error for ParseMonthError {}
#[cfg(any(feature = "std", test))]
impl std::error::Error for ParseMonthError {
#[allow(deprecated)]
fn description(&self) -> &str {
"Month parser error, see to_string() for details"
}
}

#[cfg(feature = "std")]
#[cfg(any(feature = "std", test))]
impl fmt::Display for ParseMonthError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "ParseWeekdayError {{ .. }}")
Expand Down

0 comments on commit 38c7f59

Please sign in to comment.