Skip to content

Commit

Permalink
use non_exhaustive attribute (MSRV: 1.40)
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Apr 18, 2023
1 parent 44eb42e commit f5018ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 1 addition & 5 deletions src/format/mod.rs
Expand Up @@ -357,6 +357,7 @@ impl ParseError {

/// The category of parse error
#[derive(Debug, Clone, PartialEq, Eq, Copy, Hash)]
#[non_exhaustive]
pub enum ParseErrorKind {
/// Given field is out of permitted range.
OutOfRange,
Expand Down Expand Up @@ -385,10 +386,6 @@ pub enum ParseErrorKind {

/// There was an error on the formatting string, or there were non-supported formating items.
BadFormat,

// TODO: Change this to `#[non_exhaustive]` (on the enum) when MSRV is increased
#[doc(hidden)]
__Nonexhaustive,
}

/// Same as `Result<T, ParseError>`.
Expand All @@ -404,7 +401,6 @@ impl fmt::Display for ParseError {
ParseErrorKind::TooShort => write!(f, "premature end of input"),
ParseErrorKind::TooLong => write!(f, "trailing input"),
ParseErrorKind::BadFormat => write!(f, "bad or unsupported format string"),
_ => unreachable!(),
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/format/parsed.rs
Expand Up @@ -23,6 +23,7 @@ use crate::{Datelike, Timelike};
/// - `to_*` methods try to make a concrete date and time value out of set fields.
/// It fully checks any remaining out-of-range conditions and inconsistent/impossible fields.
#[derive(Clone, PartialEq, Eq, Debug, Default, Hash)]
#[non_exhaustive]
pub struct Parsed {
/// Year.
///
Expand Down Expand Up @@ -104,9 +105,6 @@ pub struct Parsed {

/// Offset from the local time to UTC, in seconds.
pub offset: Option<i32>,

/// A dummy field to make this type not fully destructible (required for API stability).
_dummy: (),
}

/// Checks if `old` is either empty or has the same value as `new` (i.e. "consistent"),
Expand Down

0 comments on commit f5018ef

Please sign in to comment.