mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-20 05:41:04 +00:00
Resolve redundant_field_names clippy lint
This commit is contained in:
@@ -2708,7 +2708,7 @@ struct FromStrVisitor<T> {
|
|||||||
impl<T> FromStrVisitor<T> {
|
impl<T> FromStrVisitor<T> {
|
||||||
fn new(expecting: &'static str) -> Self {
|
fn new(expecting: &'static str) -> Self {
|
||||||
FromStrVisitor {
|
FromStrVisitor {
|
||||||
expecting: expecting,
|
expecting,
|
||||||
ty: PhantomData,
|
ty: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub fn encode(c: char) -> Encode {
|
|||||||
buf[3] = (code & 0x3F) as u8 | TAG_CONT;
|
buf[3] = (code & 0x3F) as u8 | TAG_CONT;
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
Encode { buf: buf, pos: pos }
|
Encode { buf, pos }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Encode {
|
pub struct Encode {
|
||||||
|
|||||||
+14
-18
@@ -251,7 +251,7 @@ macro_rules! primitive_deserializer {
|
|||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub fn new(value: $ty) -> Self {
|
pub fn new(value: $ty) -> Self {
|
||||||
$name {
|
$name {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ impl<E> U32Deserializer<E> {
|
|||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub fn new(value: u32) -> Self {
|
pub fn new(value: u32) -> Self {
|
||||||
U32Deserializer {
|
U32Deserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,7 +419,7 @@ impl<'a, E> StrDeserializer<'a, E> {
|
|||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub fn new(value: &'a str) -> Self {
|
pub fn new(value: &'a str) -> Self {
|
||||||
StrDeserializer {
|
StrDeserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -498,7 +498,7 @@ impl<'de, E> BorrowedStrDeserializer<'de, E> {
|
|||||||
/// Create a new borrowed deserializer from the given string.
|
/// Create a new borrowed deserializer from the given string.
|
||||||
pub fn new(value: &'de str) -> BorrowedStrDeserializer<'de, E> {
|
pub fn new(value: &'de str) -> BorrowedStrDeserializer<'de, E> {
|
||||||
BorrowedStrDeserializer {
|
BorrowedStrDeserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,7 +598,7 @@ impl<E> StringDeserializer<E> {
|
|||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub fn new(value: String) -> Self {
|
pub fn new(value: String) -> Self {
|
||||||
StringDeserializer {
|
StringDeserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -701,7 +701,7 @@ impl<'a, E> CowStrDeserializer<'a, E> {
|
|||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub fn new(value: Cow<'a, str>) -> Self {
|
pub fn new(value: Cow<'a, str>) -> Self {
|
||||||
CowStrDeserializer {
|
CowStrDeserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -783,7 +783,7 @@ impl<'a, E> BytesDeserializer<'a, E> {
|
|||||||
/// Create a new deserializer from the given bytes.
|
/// Create a new deserializer from the given bytes.
|
||||||
pub fn new(value: &'a [u8]) -> Self {
|
pub fn new(value: &'a [u8]) -> Self {
|
||||||
BytesDeserializer {
|
BytesDeserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -842,7 +842,7 @@ impl<'de, E> BorrowedBytesDeserializer<'de, E> {
|
|||||||
/// Create a new borrowed deserializer from the given borrowed bytes.
|
/// Create a new borrowed deserializer from the given borrowed bytes.
|
||||||
pub fn new(value: &'de [u8]) -> Self {
|
pub fn new(value: &'de [u8]) -> Self {
|
||||||
BorrowedBytesDeserializer {
|
BorrowedBytesDeserializer {
|
||||||
value: value,
|
value,
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1053,7 +1053,7 @@ pub struct SeqAccessDeserializer<A> {
|
|||||||
impl<A> SeqAccessDeserializer<A> {
|
impl<A> SeqAccessDeserializer<A> {
|
||||||
/// Construct a new `SeqAccessDeserializer<A>`.
|
/// Construct a new `SeqAccessDeserializer<A>`.
|
||||||
pub fn new(seq: A) -> Self {
|
pub fn new(seq: A) -> Self {
|
||||||
SeqAccessDeserializer { seq: seq }
|
SeqAccessDeserializer { seq }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1454,7 +1454,7 @@ pub struct MapAccessDeserializer<A> {
|
|||||||
impl<A> MapAccessDeserializer<A> {
|
impl<A> MapAccessDeserializer<A> {
|
||||||
/// Construct a new `MapAccessDeserializer<A>`.
|
/// Construct a new `MapAccessDeserializer<A>`.
|
||||||
pub fn new(map: A) -> Self {
|
pub fn new(map: A) -> Self {
|
||||||
MapAccessDeserializer { map: map }
|
MapAccessDeserializer { map }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1519,7 +1519,7 @@ pub struct EnumAccessDeserializer<A> {
|
|||||||
impl<A> EnumAccessDeserializer<A> {
|
impl<A> EnumAccessDeserializer<A> {
|
||||||
/// Construct a new `EnumAccessDeserializer<A>`.
|
/// Construct a new `EnumAccessDeserializer<A>`.
|
||||||
pub fn new(access: A) -> Self {
|
pub fn new(access: A) -> Self {
|
||||||
EnumAccessDeserializer { access: access }
|
EnumAccessDeserializer { access }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1613,7 +1613,7 @@ mod private {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_as_enum<A>(map: A) -> MapAsEnum<A> {
|
pub fn map_as_enum<A>(map: A) -> MapAsEnum<A> {
|
||||||
MapAsEnum { map: map }
|
MapAsEnum { map }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de, A> VariantAccess<'de> for MapAsEnum<A>
|
impl<'de, A> VariantAccess<'de> for MapAsEnum<A>
|
||||||
@@ -1637,10 +1637,7 @@ mod private {
|
|||||||
where
|
where
|
||||||
V: Visitor<'de>,
|
V: Visitor<'de>,
|
||||||
{
|
{
|
||||||
self.map.next_value_seed(SeedTupleVariant {
|
self.map.next_value_seed(SeedTupleVariant { len, visitor })
|
||||||
len: len,
|
|
||||||
visitor: visitor,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn struct_variant<V>(
|
fn struct_variant<V>(
|
||||||
@@ -1651,8 +1648,7 @@ mod private {
|
|||||||
where
|
where
|
||||||
V: Visitor<'de>,
|
V: Visitor<'de>,
|
||||||
{
|
{
|
||||||
self.map
|
self.map.next_value_seed(SeedStructVariant { visitor })
|
||||||
.next_value_seed(SeedStructVariant { visitor: visitor })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -518,7 +518,7 @@ mod content {
|
|||||||
impl<'de> TagOrContentVisitor<'de> {
|
impl<'de> TagOrContentVisitor<'de> {
|
||||||
fn new(name: &'static str) -> Self {
|
fn new(name: &'static str) -> Self {
|
||||||
TagOrContentVisitor {
|
TagOrContentVisitor {
|
||||||
name: name,
|
name,
|
||||||
value: PhantomData,
|
value: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -815,7 +815,7 @@ mod content {
|
|||||||
pub fn new(name: &'static str, expecting: &'static str) -> Self {
|
pub fn new(name: &'static str, expecting: &'static str) -> Self {
|
||||||
TaggedContentVisitor {
|
TaggedContentVisitor {
|
||||||
tag_name: name,
|
tag_name: name,
|
||||||
expecting: expecting,
|
expecting,
|
||||||
value: PhantomData,
|
value: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -859,7 +859,7 @@ mod content {
|
|||||||
};
|
};
|
||||||
let rest = de::value::SeqAccessDeserializer::new(seq);
|
let rest = de::value::SeqAccessDeserializer::new(seq);
|
||||||
Ok(TaggedContent {
|
Ok(TaggedContent {
|
||||||
tag: tag,
|
tag,
|
||||||
content: try!(Content::deserialize(rest)),
|
content: try!(Content::deserialize(rest)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -887,7 +887,7 @@ mod content {
|
|||||||
match tag {
|
match tag {
|
||||||
None => Err(de::Error::missing_field(self.tag_name)),
|
None => Err(de::Error::missing_field(self.tag_name)),
|
||||||
Some(tag) => Ok(TaggedContent {
|
Some(tag) => Ok(TaggedContent {
|
||||||
tag: tag,
|
tag,
|
||||||
content: Content::Map(vec),
|
content: Content::Map(vec),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
@@ -1464,7 +1464,7 @@ mod content {
|
|||||||
/// private API, don't use
|
/// private API, don't use
|
||||||
pub fn new(content: Content<'de>) -> Self {
|
pub fn new(content: Content<'de>) -> Self {
|
||||||
ContentDeserializer {
|
ContentDeserializer {
|
||||||
content: content,
|
content,
|
||||||
err: PhantomData,
|
err: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1485,8 +1485,8 @@ mod content {
|
|||||||
{
|
{
|
||||||
pub fn new(variant: Content<'de>, value: Option<Content<'de>>) -> EnumDeserializer<'de, E> {
|
pub fn new(variant: Content<'de>, value: Option<Content<'de>>) -> EnumDeserializer<'de, E> {
|
||||||
EnumDeserializer {
|
EnumDeserializer {
|
||||||
variant: variant,
|
variant,
|
||||||
value: value,
|
value,
|
||||||
err: PhantomData,
|
err: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2142,8 +2142,8 @@ mod content {
|
|||||||
};
|
};
|
||||||
|
|
||||||
visitor.visit_enum(EnumRefDeserializer {
|
visitor.visit_enum(EnumRefDeserializer {
|
||||||
variant: variant,
|
variant,
|
||||||
value: value,
|
value,
|
||||||
err: PhantomData,
|
err: PhantomData,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -2187,7 +2187,7 @@ mod content {
|
|||||||
/// private API, don't use
|
/// private API, don't use
|
||||||
pub fn new(content: &'a Content<'de>) -> Self {
|
pub fn new(content: &'a Content<'de>) -> Self {
|
||||||
ContentRefDeserializer {
|
ContentRefDeserializer {
|
||||||
content: content,
|
content,
|
||||||
err: PhantomData,
|
err: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2496,8 +2496,8 @@ mod content {
|
|||||||
/// Not public API.
|
/// Not public API.
|
||||||
pub fn new(type_name: &'a str, variant_name: &'a str) -> Self {
|
pub fn new(type_name: &'a str, variant_name: &'a str) -> Self {
|
||||||
InternallyTaggedUnitVisitor {
|
InternallyTaggedUnitVisitor {
|
||||||
type_name: type_name,
|
type_name,
|
||||||
variant_name: variant_name,
|
variant_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2541,8 +2541,8 @@ mod content {
|
|||||||
/// Not public API.
|
/// Not public API.
|
||||||
pub fn new(type_name: &'a str, variant_name: &'a str) -> Self {
|
pub fn new(type_name: &'a str, variant_name: &'a str) -> Self {
|
||||||
UntaggedUnitVisitor {
|
UntaggedUnitVisitor {
|
||||||
type_name: type_name,
|
type_name,
|
||||||
variant_name: variant_name,
|
variant_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2793,7 +2793,7 @@ where
|
|||||||
visitor.visit_map(FlatStructAccess {
|
visitor.visit_map(FlatStructAccess {
|
||||||
iter: self.0.iter_mut(),
|
iter: self.0.iter_mut(),
|
||||||
pending_content: None,
|
pending_content: None,
|
||||||
fields: fields,
|
fields,
|
||||||
_marker: PhantomData,
|
_marker: PhantomData,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-18
@@ -27,10 +27,10 @@ where
|
|||||||
T: Serialize,
|
T: Serialize,
|
||||||
{
|
{
|
||||||
value.serialize(TaggedSerializer {
|
value.serialize(TaggedSerializer {
|
||||||
type_ident: type_ident,
|
type_ident,
|
||||||
variant_ident: variant_ident,
|
variant_ident,
|
||||||
tag: tag,
|
tag,
|
||||||
variant_name: variant_name,
|
variant_name,
|
||||||
delegate: serializer,
|
delegate: serializer,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -350,8 +350,8 @@ mod content {
|
|||||||
impl<M> SerializeTupleVariantAsMapValue<M> {
|
impl<M> SerializeTupleVariantAsMapValue<M> {
|
||||||
pub fn new(map: M, name: &'static str, len: usize) -> Self {
|
pub fn new(map: M, name: &'static str, len: usize) -> Self {
|
||||||
SerializeTupleVariantAsMapValue {
|
SerializeTupleVariantAsMapValue {
|
||||||
map: map,
|
map,
|
||||||
name: name,
|
name,
|
||||||
fields: Vec::with_capacity(len),
|
fields: Vec::with_capacity(len),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,8 +390,8 @@ mod content {
|
|||||||
impl<M> SerializeStructVariantAsMapValue<M> {
|
impl<M> SerializeStructVariantAsMapValue<M> {
|
||||||
pub fn new(map: M, name: &'static str, len: usize) -> Self {
|
pub fn new(map: M, name: &'static str, len: usize) -> Self {
|
||||||
SerializeStructVariantAsMapValue {
|
SerializeStructVariantAsMapValue {
|
||||||
map: map,
|
map,
|
||||||
name: name,
|
name,
|
||||||
fields: Vec::with_capacity(len),
|
fields: Vec::with_capacity(len),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -711,7 +711,7 @@ mod content {
|
|||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<Self::SerializeTupleStruct, E> {
|
) -> Result<Self::SerializeTupleStruct, E> {
|
||||||
Ok(SerializeTupleStruct {
|
Ok(SerializeTupleStruct {
|
||||||
name: name,
|
name,
|
||||||
fields: Vec::with_capacity(len),
|
fields: Vec::with_capacity(len),
|
||||||
error: PhantomData,
|
error: PhantomData,
|
||||||
})
|
})
|
||||||
@@ -725,9 +725,9 @@ mod content {
|
|||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<Self::SerializeTupleVariant, E> {
|
) -> Result<Self::SerializeTupleVariant, E> {
|
||||||
Ok(SerializeTupleVariant {
|
Ok(SerializeTupleVariant {
|
||||||
name: name,
|
name,
|
||||||
variant_index: variant_index,
|
variant_index,
|
||||||
variant: variant,
|
variant,
|
||||||
fields: Vec::with_capacity(len),
|
fields: Vec::with_capacity(len),
|
||||||
error: PhantomData,
|
error: PhantomData,
|
||||||
})
|
})
|
||||||
@@ -747,7 +747,7 @@ mod content {
|
|||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<Self::SerializeStruct, E> {
|
) -> Result<Self::SerializeStruct, E> {
|
||||||
Ok(SerializeStruct {
|
Ok(SerializeStruct {
|
||||||
name: name,
|
name,
|
||||||
fields: Vec::with_capacity(len),
|
fields: Vec::with_capacity(len),
|
||||||
error: PhantomData,
|
error: PhantomData,
|
||||||
})
|
})
|
||||||
@@ -761,9 +761,9 @@ mod content {
|
|||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<Self::SerializeStructVariant, E> {
|
) -> Result<Self::SerializeStructVariant, E> {
|
||||||
Ok(SerializeStructVariant {
|
Ok(SerializeStructVariant {
|
||||||
name: name,
|
name,
|
||||||
variant_index: variant_index,
|
variant_index,
|
||||||
variant: variant,
|
variant,
|
||||||
fields: Vec::with_capacity(len),
|
fields: Vec::with_capacity(len),
|
||||||
error: PhantomData,
|
error: PhantomData,
|
||||||
})
|
})
|
||||||
@@ -1273,8 +1273,8 @@ where
|
|||||||
{
|
{
|
||||||
fn new(map: &'a mut M, name: &'static str) -> FlatMapSerializeStructVariantAsMapValue<'a, M> {
|
fn new(map: &'a mut M, name: &'static str) -> FlatMapSerializeStructVariantAsMapValue<'a, M> {
|
||||||
FlatMapSerializeStructVariantAsMapValue {
|
FlatMapSerializeStructVariantAsMapValue {
|
||||||
map: map,
|
map,
|
||||||
name: name,
|
name,
|
||||||
fields: Vec::new(),
|
fields: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user