Skip to content

Commit

Permalink
Fix features in drawing error.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
staticintlucas committed Oct 27, 2024
1 parent 8c7917f commit b00562f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions keyset-drawing/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ use std::fmt;

use geom::Size;

#[cfg(feature = "png")]
use crate::png::Pixel;

/// A drawing creation error
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub enum Error {
/// The drawing is larger than the maximum PNG dimensions
#[cfg(feature = "svg")]
#[cfg(feature = "png")]
PngDimensionsError(Size<Pixel>),
}

impl fmt::Display for Error {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
#[cfg(feature = "svg")]
#[cfg(feature = "png")]
Self::PngDimensionsError(dims) => write!(f, "invalid PNG dimensions {dims:?}"),
}
}
Expand All @@ -31,6 +32,7 @@ mod tests {

use crate::{Drawing, Options};

#[cfg(feature = "png")]
#[test]
fn error_fmt() {
let key1 = key::Key::example();
Expand Down

0 comments on commit b00562f

Please sign in to comment.