diff --git a/serde/src/ser/impossible.rs b/serde/src/ser/impossible.rs index 975c4af1..c90c98f5 100644 --- a/serde/src/ser/impossible.rs +++ b/serde/src/ser/impossible.rs @@ -61,133 +61,133 @@ use ser::{self, Serialize, SerializeSeq, SerializeTuple, SerializeTupleStruct, /// [`SerializeMap`]: trait.SerializeMap.html /// [`SerializeStruct`]: trait.SerializeStruct.html /// [`SerializeStructVariant`]: trait.SerializeStructVariant.html -pub struct Impossible { +pub struct Impossible { void: Void, - _marker: PhantomData<(Ok, E)>, + _marker: PhantomData<(Ok, Error)>, } enum Void {} -impl SerializeSeq for Impossible +impl SerializeSeq for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; - fn serialize_element(&mut self, _value: &T) -> Result<(), E> { + fn serialize_element(&mut self, _value: &T) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } } -impl SerializeTuple for Impossible +impl SerializeTuple for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; - fn serialize_element(&mut self, _value: &T) -> Result<(), E> { + fn serialize_element(&mut self, _value: &T) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } } -impl SerializeTupleStruct for Impossible +impl SerializeTupleStruct for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; - fn serialize_field(&mut self, _value: &T) -> Result<(), E> { + fn serialize_field(&mut self, _value: &T) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } } -impl SerializeTupleVariant for Impossible +impl SerializeTupleVariant for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; - fn serialize_field(&mut self, _value: &T) -> Result<(), E> { + fn serialize_field(&mut self, _value: &T) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } } -impl SerializeMap for Impossible +impl SerializeMap for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; - fn serialize_key(&mut self, _key: &T) -> Result<(), E> { + fn serialize_key(&mut self, _key: &T) -> Result<(), Error> { match self.void {} } - fn serialize_value(&mut self, _value: &T) -> Result<(), E> { + fn serialize_value(&mut self, _value: &T) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } } -impl SerializeStruct for Impossible +impl SerializeStruct for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; fn serialize_field( &mut self, _key: &'static str, _value: &T, - ) -> Result<(), E> { + ) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } } -impl SerializeStructVariant for Impossible +impl SerializeStructVariant for Impossible where - E: ser::Error, + Error: ser::Error, { type Ok = Ok; - type Error = E; + type Error = Error; fn serialize_field( &mut self, _key: &'static str, _value: &T, - ) -> Result<(), E> { + ) -> Result<(), Error> { match self.void {} } - fn end(self) -> Result { + fn end(self) -> Result { match self.void {} } }