diff options
Diffstat (limited to 'vendor/time/src/error/parse.rs')
-rw-r--r-- | vendor/time/src/error/parse.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/vendor/time/src/error/parse.rs b/vendor/time/src/error/parse.rs index b90ac74e7..09935b1c9 100644 --- a/vendor/time/src/error/parse.rs +++ b/vendor/time/src/error/parse.rs @@ -3,18 +3,23 @@ use core::fmt; use crate::error::{self, ParseFromDescription, TryFromParsed}; +use crate::internal_macros::bug; /// An error that occurred at some stage of parsing. #[allow(variant_size_differences)] #[non_exhaustive] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Parse { - #[allow(clippy::missing_docs_in_private_items)] + #[allow(missing_docs)] TryFromParsed(TryFromParsed), - #[allow(clippy::missing_docs_in_private_items)] + #[allow(missing_docs)] ParseFromDescription(ParseFromDescription), /// The input should have ended, but there were characters remaining. #[non_exhaustive] + #[deprecated( + since = "0.3.28", + note = "no longer output. moved to the `ParseFromDescription` variant" + )] UnexpectedTrailingCharacters, } @@ -23,7 +28,8 @@ impl fmt::Display for Parse { match self { Self::TryFromParsed(err) => err.fmt(f), Self::ParseFromDescription(err) => err.fmt(f), - Self::UnexpectedTrailingCharacters => f.write_str("unexpected trailing characters"), + #[allow(deprecated)] + Self::UnexpectedTrailingCharacters => bug!("variant should not be used"), } } } @@ -34,7 +40,8 @@ impl std::error::Error for Parse { match self { Self::TryFromParsed(err) => Some(err), Self::ParseFromDescription(err) => Some(err), - Self::UnexpectedTrailingCharacters => None, + #[allow(deprecated)] + Self::UnexpectedTrailingCharacters => bug!("variant should not be used"), } } } @@ -78,7 +85,8 @@ impl From<Parse> for crate::Error { match err { Parse::TryFromParsed(err) => Self::TryFromParsed(err), Parse::ParseFromDescription(err) => Self::ParseFromDescription(err), - Parse::UnexpectedTrailingCharacters => Self::UnexpectedTrailingCharacters, + #[allow(deprecated)] + Parse::UnexpectedTrailingCharacters => bug!("variant should not be used"), } } } @@ -89,7 +97,8 @@ impl TryFrom<crate::Error> for Parse { fn try_from(err: crate::Error) -> Result<Self, Self::Error> { match err { crate::Error::ParseFromDescription(err) => Ok(Self::ParseFromDescription(err)), - crate::Error::UnexpectedTrailingCharacters => Ok(Self::UnexpectedTrailingCharacters), + #[allow(deprecated)] + crate::Error::UnexpectedTrailingCharacters => bug!("variant should not be used"), crate::Error::TryFromParsed(err) => Ok(Self::TryFromParsed(err)), _ => Err(error::DifferentVariant), } |