From 0686c81c573949dac9fdd65913b50f248a51a587 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 6 Jan 2017 12:41:08 -0800 Subject: [PATCH] refactor(error): turn Void from an empty enum to a struct --- src/error.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/error.rs b/src/error.rs index 463a6f94..ed107d94 100644 --- a/src/error.rs +++ b/src/error.rs @@ -55,11 +55,11 @@ pub enum Error { } #[doc(hidden)] -pub enum Void {} +pub struct Void(()); impl fmt::Debug for Void { fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { - match *self {} + unreachable!() } } @@ -87,7 +87,7 @@ impl StdError for Error { Uri(ref e) => e.description(), Io(ref e) => e.description(), Utf8(ref e) => e.description(), - Error::__Nonexhaustive(ref void) => match *void {} + Error::__Nonexhaustive(..) => unreachable!(), } } @@ -96,7 +96,7 @@ impl StdError for Error { Io(ref error) => Some(error), Uri(ref error) => Some(error), Utf8(ref error) => Some(error), - Error::__Nonexhaustive(ref void) => match *void {}, + Error::__Nonexhaustive(..) => unreachable!(), _ => None, } }