From a52b20bdbc518df9ab9814d2be62604c1de0509f Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Fri, 24 Nov 2023 15:22:54 +0100 Subject: [PATCH] Add `non_exhaustive` to error enums --- src/raw.rs | 3 ++- src/types/mod.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/raw.rs b/src/raw.rs index eb95b3d..38a8bb2 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -80,6 +80,7 @@ impl fmt::Display for ParseError { /// /// Also see [`ParseError`]. #[derive(Debug, Clone, PartialEq)] +#[non_exhaustive] pub enum ParseErrorKind { /// The file ended prematurely. UnexpectedEof, @@ -516,7 +517,7 @@ impl<'s> Pair<'s> { /// Whether a character is allowed in an entry key #[inline] pub fn is_key(c: char) -> bool { - !matches!(c, ',' | '}' ) && !c.is_control() && !c.is_whitespace() + !matches!(c, ',' | '}') && !c.is_control() && !c.is_whitespace() } /// Whether a character can start an identifier. diff --git a/src/types/mod.rs b/src/types/mod.rs index 3d61c97..d728663 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -48,6 +48,7 @@ impl fmt::Display for TypeError { /// /// Also see [`TypeError`]. #[derive(Debug, Clone, PartialEq)] +#[non_exhaustive] pub enum TypeErrorKind { /// The date range was open on both sides. UndefinedRange,