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