diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index c9eea554..571c73b7 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -400,8 +400,8 @@ pub trait Deserializer { /// This method hints that the `Deserialize` type is expecting a fixed size array. This allows /// deserializers to parse arrays that aren't tagged as arrays. fn deserialize_seq_fixed_size(&mut self, - _len: usize, - visitor: V) -> Result + len: usize, + visitor: V) -> Result where V: Visitor; /// This method hints that the `Deserialize` type is expecting a `Vec`. This allows @@ -418,7 +418,7 @@ pub trait Deserializer { /// This method hints that the `Deserialize` type is expecting a unit struct. This allows /// deserializers to a unit struct that aren't tagged as a unit struct. fn deserialize_unit_struct(&mut self, - _name: &'static str, + name: &'static str, visitor: V) -> Result where V: Visitor; @@ -433,7 +433,7 @@ pub trait Deserializer { /// This method hints that the `Deserialize` type is expecting a tuple struct. This allows /// deserializers to parse sequences that aren't tagged as sequences. fn deserialize_tuple_struct(&mut self, - _name: &'static str, + name: &'static str, len: usize, visitor: V) -> Result where V: Visitor; @@ -441,8 +441,8 @@ pub trait Deserializer { /// This method hints that the `Deserialize` type is expecting a struct. This allows /// deserializers to parse sequences that aren't tagged as maps. fn deserialize_struct(&mut self, - _name: &'static str, - _fields: &'static [&'static str], + name: &'static str, + fields: &'static [&'static str], visitor: V) -> Result where V: Visitor; @@ -454,16 +454,16 @@ pub trait Deserializer { /// This method hints that the `Deserialize` type is expecting a tuple value. This allows /// deserializers that provide a custom tuple serialization to properly deserialize the type. - fn deserialize_tuple(&mut self, _len: usize, visitor: V) -> Result + fn deserialize_tuple(&mut self, len: usize, visitor: V) -> Result where V: Visitor; /// This method hints that the `Deserialize` type is expecting an enum value. This allows /// deserializers that provide a custom enumeration serialization to properly deserialize the /// type. fn deserialize_enum(&mut self, - _enum: &'static str, - _variants: &'static [&'static str], - _visitor: V) -> Result + name: &'static str, + variants: &'static [&'static str], + visitor: V) -> Result where V: EnumVisitor; /// This method hints that the `Deserialize` type needs to deserialize a value whose type @@ -480,9 +480,10 @@ pub trait Visitor { type Value: Deserialize; /// `visit_bool` deserializes a `bool` into a `Value`. - fn visit_bool(&mut self, _v: bool) -> Result + fn visit_bool(&mut self, v: bool) -> Result where E: Error, { + let _ = v; Err(Error::invalid_type(Type::Bool)) } @@ -515,9 +516,10 @@ pub trait Visitor { } /// `visit_i64` deserializes a `i64` into a `Value`. - fn visit_i64(&mut self, _v: i64) -> Result + fn visit_i64(&mut self, v: i64) -> Result where E: Error, { + let _ = v; Err(Error::invalid_type(Type::I64)) } @@ -550,9 +552,10 @@ pub trait Visitor { } /// `visit_u64` deserializes a `u64` into a `Value`. - fn visit_u64(&mut self, _v: u64) -> Result + fn visit_u64(&mut self, v: u64) -> Result where E: Error, { + let _ = v; Err(Error::invalid_type(Type::U64)) } @@ -564,9 +567,10 @@ pub trait Visitor { } /// `visit_f64` deserializes a `f64` into a `Value`. - fn visit_f64(&mut self, _v: f64) -> Result + fn visit_f64(&mut self, v: f64) -> Result where E: Error, { + let _ = v; Err(Error::invalid_type(Type::F64)) } @@ -579,9 +583,10 @@ pub trait Visitor { } /// `visit_str` deserializes a `&str` into a `Value`. - fn visit_str(&mut self, _v: &str) -> Result + fn visit_str(&mut self, v: &str) -> Result where E: Error, { + let _ = v; Err(Error::invalid_type(Type::Str)) } @@ -605,9 +610,10 @@ pub trait Visitor { /// `visit_unit_struct` deserializes a unit struct into a `Value`. #[inline] - fn visit_unit_struct(&mut self, _name: &'static str) -> Result + fn visit_unit_struct(&mut self, name: &'static str) -> Result where E: Error, { + let _ = name; self.visit_unit() } @@ -619,37 +625,42 @@ pub trait Visitor { } /// `visit_some` deserializes a value into a `Value`. - fn visit_some(&mut self, _deserializer: &mut D) -> Result + fn visit_some(&mut self, deserializer: &mut D) -> Result where D: Deserializer, { + let _ = deserializer; Err(Error::invalid_type(Type::Option)) } /// `visit_newtype_struct` deserializes a value into a `Value`. - fn visit_newtype_struct(&mut self, _deserializer: &mut D) -> Result + fn visit_newtype_struct(&mut self, deserializer: &mut D) -> Result where D: Deserializer, { + let _ = deserializer; Err(Error::invalid_type(Type::NewtypeStruct)) } /// `visit_seq` deserializes a `SeqVisitor` into a `Value`. - fn visit_seq(&mut self, _visitor: V) -> Result + fn visit_seq(&mut self, visitor: V) -> Result where V: SeqVisitor, { + let _ = visitor; Err(Error::invalid_type(Type::Seq)) } /// `visit_map` deserializes a `MapVisitor` into a `Value`. - fn visit_map(&mut self, _visitor: V) -> Result + fn visit_map(&mut self, visitor: V) -> Result where V: MapVisitor, { + let _ = visitor; Err(Error::invalid_type(Type::Map)) } /// `visit_bytes` deserializes a `&[u8]` into a `Value`. - fn visit_bytes(&mut self, _v: &[u8]) -> Result + fn visit_bytes(&mut self, v: &[u8]) -> Result where E: Error, { + let _ = v; Err(Error::invalid_type(Type::Bytes)) } @@ -834,16 +845,16 @@ pub trait VariantVisitor { /// If no tuple variants are expected, yield a /// `Err(serde::de::Error::invalid_type(serde::de::Type::TupleVariant))` fn visit_tuple(&mut self, - _len: usize, - _visitor: V) -> Result + len: usize, + visitor: V) -> Result where V: Visitor; /// `visit_struct` is called when deserializing a struct-like variant. /// If no struct variants are expected, yield a /// `Err(serde::de::Error::invalid_type(serde::de::Type::StructVariant))` fn visit_struct(&mut self, - _fields: &'static [&'static str], - _visitor: V) -> Result + fields: &'static [&'static str], + visitor: V) -> Result where V: Visitor; }