Skip to content

Commit

Permalink
Make FrontBufferError a struct, since it only has one variant now
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 authored and Drakulix committed Dec 2, 2024
1 parent a3d52b0 commit 9b5ab6a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,11 @@ impl<T: 'static> fmt::Debug for Surface<T> {

/// 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")
}
}

Expand Down Expand Up @@ -74,7 +69,7 @@ impl<T: 'static> Surface<T> {
};
Ok(buffer)
} else {
Err(FrontBufferError::Unknown)
Err(FrontBufferError)
}
}

Expand Down

0 comments on commit 9b5ab6a

Please sign in to comment.