diff --git a/src/parser.rs b/src/parser.rs index 44f95b0f6..bf973659d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -91,8 +91,8 @@ simple_enum_error! { } impl fmt::Display for ParseError { - fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { - self.description().fmt(fmt) + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + fmt::Display::fmt(self.description(), f) } } @@ -151,8 +151,8 @@ syntax_violation_enum! { } impl fmt::Display for SyntaxViolation { - fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { - self.description().fmt(fmt) + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + fmt::Display::fmt(self.description(), f) } } diff --git a/tests/unit.rs b/tests/unit.rs index d5e81986a..9918ea316 100644 --- a/tests/unit.rs +++ b/tests/unit.rs @@ -512,6 +512,7 @@ fn test_syntax_violation_callback() { let v = violation.take().unwrap(); assert_eq!(v, ExpectedDoubleSlash); assert_eq!(v.description(), "expected //"); + assert_eq!(v.to_string(), "expected //"); } #[test]