Make sure the visit_{enum,struct,tuple_struct} name is a &'static str

This commit is contained in:
Erick Tryzelaar 2015-07-29 12:07:29 -07:00
parent 6c9cebdcc3
commit 578a0178b5
2 changed files with 10 additions and 8 deletions

View File

@ -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<V>(&mut self, _name: &str, visitor: V) -> Result<V::Value, Self::Error>
fn visit_unit_struct<V>(&mut self,
_name: &'static str,
visitor: V) -> Result<V::Value, Self::Error>
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<V>(&mut self,
_name: &str,
_name: &'static str,
len: usize,
visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor,
@ -233,7 +235,7 @@ pub trait Deserializer {
/// deserializers to parse sequences that aren't tagged as maps.
#[inline]
fn visit_struct<V>(&mut self,
_name: &str,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V) -> Result<V::Value, Self::Error>
where V: Visitor,
@ -255,7 +257,7 @@ pub trait Deserializer {
/// type.
#[inline]
fn visit_enum<V>(&mut self,
_enum: &str,
_enum: &'static str,
_variants: &'static [&'static str],
_visitor: V) -> Result<V::Value, Self::Error>
where V: EnumVisitor,
@ -395,7 +397,7 @@ pub trait Visitor {
}
#[inline]
fn visit_unit_struct<E>(&mut self, _name: &str) -> Result<Self::Value, E>
fn visit_unit_struct<E>(&mut self, _name: &'static str) -> Result<Self::Value, E>
where E: Error,
{
self.visit_unit()

View File

@ -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()
}