From 9b5ab6a0e50e6b8bbea9eaabbd25fe2bb190189f Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 2 Dec 2024 09:09:24 -0800 Subject: [PATCH] Make `FrontBufferError` a `struct`, since it only has one variant now --- src/surface.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/surface.rs b/src/surface.rs index 0509b23..1171f2d 100644 --- a/src/surface.rs +++ b/src/surface.rs @@ -22,16 +22,11 @@ impl fmt::Debug for Surface { /// Errors that may happen when locking the front buffer #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum FrontBufferError { - /// An unknown error happened - Unknown, -} +pub struct FrontBufferError; impl fmt::Display for FrontBufferError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - FrontBufferError::Unknown => write!(f, "Unknown error"), - } + write!(f, "Unknown error") } } @@ -74,7 +69,7 @@ impl Surface { }; Ok(buffer) } else { - Err(FrontBufferError::Unknown) + Err(FrontBufferError) } }