diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index a04e0a74..611c8c8e 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -211,7 +211,9 @@ pub trait Deserializer { /// This method hints that the `Deserialize` type is expecting a named unit. This allows /// deserializers to a named unit that aren't tagged as a named unit. #[inline] - fn visit_unit_struct(&mut self, _name: &str, visitor: V) -> Result + fn visit_unit_struct(&mut self, + _name: &'static str, + visitor: V) -> Result where V: Visitor, { self.visit_unit(visitor) @@ -221,7 +223,7 @@ pub trait Deserializer { /// deserializers to parse sequences that aren't tagged as sequences. #[inline] fn visit_tuple_struct(&mut self, - _name: &str, + _name: &'static str, len: usize, visitor: V) -> Result where V: Visitor, @@ -233,7 +235,7 @@ pub trait Deserializer { /// deserializers to parse sequences that aren't tagged as maps. #[inline] fn visit_struct(&mut self, - _name: &str, + _name: &'static str, _fields: &'static [&'static str], visitor: V) -> Result where V: Visitor, @@ -255,7 +257,7 @@ pub trait Deserializer { /// type. #[inline] fn visit_enum(&mut self, - _enum: &str, + _enum: &'static str, _variants: &'static [&'static str], _visitor: V) -> Result where V: EnumVisitor, @@ -395,7 +397,7 @@ pub trait Visitor { } #[inline] - fn visit_unit_struct(&mut self, _name: &str) -> Result + fn visit_unit_struct(&mut self, _name: &'static str) -> Result where E: Error, { self.visit_unit() diff --git a/serde/src/ser/mod.rs b/serde/src/ser/mod.rs index 4484d344..ac20dad6 100644 --- a/serde/src/ser/mod.rs +++ b/serde/src/ser/mod.rs @@ -113,15 +113,15 @@ pub trait Serializer { fn visit_unit(&mut self) -> Result<(), Self::Error>; #[inline] - fn visit_unit_struct(&mut self, _name: &str) -> Result<(), Self::Error> { + fn visit_unit_struct(&mut self, _name: &'static str) -> Result<(), Self::Error> { self.visit_unit() } #[inline] fn visit_enum_unit(&mut self, - _name: &str, + _name: &'static str, _variant_index: usize, - _variant: &str) -> Result<(), Self::Error> { + _variant: &'static str) -> Result<(), Self::Error> { self.visit_unit() }