From 5e1229366d8298674753e004a8ab2ee4ca300971 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Fri, 20 May 2016 15:27:20 -0400 Subject: [PATCH] add Display impl for Mismatch --- util/src/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/src/error.rs b/util/src/error.rs index 9e76e885d..74de40734 100644 --- a/util/src/error.rs +++ b/util/src/error.rs @@ -66,6 +66,12 @@ pub struct Mismatch { pub found: T, } +impl fmt::Display for Mismatch { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("Expected {}, found {}", self.expected, self.found)) + } +} + #[derive(Debug, PartialEq, Eq)] /// Error indicating value found is outside of a valid range. pub struct OutOfBounds {