From 3cb8be3ab3d58f59d3aa38bf40ccb744788a3050 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 12 Jul 2020 12:59:57 +0100 Subject: [PATCH] display as debug --- src/error.rs | 6 ++++++ src/pieces.rs | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 454ad0f0..e52953b5 100644 --- a/src/error.rs +++ b/src/error.rs @@ -80,5 +80,11 @@ impl IdForById for PieceId { #[macro_export] macro_rules! display_as_debug { {$x:ty} => { + impl Display for $x { + fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + ::fmt(self, f) + } + } } } +pub use crate::display_as_debug; diff --git a/src/pieces.rs b/src/pieces.rs index 8173a656..17e2acc2 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -22,14 +22,10 @@ pub enum SVGProcessError { BadNumber, WriteFail, } +display_as_debug!{SVGProcessError} impl From for SVGProcessError { fn from(_: fmt::Error) -> Self { SVGProcessError::WriteFail } } -impl Display for SVGProcessError { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - ::fmt(self, f) - } -} #[throws(SVGProcessError)] pub fn svg_rescale_path(input: &str, scale: f64) -> String { -- 2.30.2