mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 13:47:58 +00:00
Resolve redundant_field_names lint in serde_derive
This commit is contained in:
@@ -156,7 +156,7 @@ pub fn with_bound(
|
||||
.collect();
|
||||
|
||||
let mut visitor = FindTyParams {
|
||||
all_type_params: all_type_params,
|
||||
all_type_params,
|
||||
relevant_type_params: HashSet::new(),
|
||||
associated_type_usage: Vec::new(),
|
||||
};
|
||||
@@ -271,7 +271,7 @@ pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Gen
|
||||
.collect();
|
||||
|
||||
syn::Generics {
|
||||
params: params,
|
||||
params,
|
||||
..generics.clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,11 +134,11 @@ impl Parameters {
|
||||
let has_getter = cont.data.has_getter();
|
||||
|
||||
Parameters {
|
||||
local: local,
|
||||
this: this,
|
||||
generics: generics,
|
||||
borrowed: borrowed,
|
||||
has_getter: has_getter,
|
||||
local,
|
||||
this,
|
||||
generics,
|
||||
borrowed,
|
||||
has_getter,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ impl<'a> Container<'a> {
|
||||
|
||||
let mut item = Container {
|
||||
ident: item.ident.clone(),
|
||||
attrs: attrs,
|
||||
data: data,
|
||||
attrs,
|
||||
data,
|
||||
generics: &item.generics,
|
||||
original: item,
|
||||
};
|
||||
@@ -148,9 +148,9 @@ fn enum_from_ast<'a>(
|
||||
struct_from_ast(cx, &variant.fields, Some(&attrs), container_default);
|
||||
Variant {
|
||||
ident: variant.ident.clone(),
|
||||
attrs: attrs,
|
||||
style: style,
|
||||
fields: fields,
|
||||
attrs,
|
||||
style,
|
||||
fields,
|
||||
original: variant,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -32,8 +32,8 @@ struct Attr<'c, T> {
|
||||
impl<'c, T> Attr<'c, T> {
|
||||
fn none(cx: &'c Ctxt, name: Symbol) -> Self {
|
||||
Attr {
|
||||
cx: cx,
|
||||
name: name,
|
||||
cx,
|
||||
name,
|
||||
tokens: TokenStream::new(),
|
||||
value: None,
|
||||
}
|
||||
@@ -101,8 +101,8 @@ struct VecAttr<'c, T> {
|
||||
impl<'c, T> VecAttr<'c, T> {
|
||||
fn none(cx: &'c Ctxt, name: Symbol) -> Self {
|
||||
VecAttr {
|
||||
cx: cx,
|
||||
name: name,
|
||||
cx,
|
||||
name,
|
||||
first_dup_tokens: TokenStream::new(),
|
||||
values: Vec::new(),
|
||||
}
|
||||
@@ -176,7 +176,7 @@ impl Name {
|
||||
serialize_renamed: ser_renamed,
|
||||
deserialize: de_name.unwrap_or(source_name),
|
||||
deserialize_renamed: de_renamed,
|
||||
deserialize_aliases: deserialize_aliases,
|
||||
deserialize_aliases,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ fn decide_tag(
|
||||
}
|
||||
}
|
||||
}
|
||||
TagType::Internal { tag: tag }
|
||||
TagType::Internal { tag }
|
||||
}
|
||||
(Some((untagged_tokens, _)), Some((tag_tokens, _)), None) => {
|
||||
cx.error_spanned_by(
|
||||
@@ -747,10 +747,7 @@ fn decide_tag(
|
||||
);
|
||||
TagType::External
|
||||
}
|
||||
(None, Some((_, tag)), Some((_, content))) => TagType::Adjacent {
|
||||
tag: tag,
|
||||
content: content,
|
||||
},
|
||||
(None, Some((_, tag)), Some((_, content))) => TagType::Adjacent { tag, content },
|
||||
(Some((untagged_tokens, _)), Some((tag_tokens, _)), Some((content_tokens, _))) => {
|
||||
cx.error_spanned_by(
|
||||
untagged_tokens,
|
||||
@@ -1383,7 +1380,7 @@ impl Field {
|
||||
let expr = syn::ExprPath {
|
||||
attrs: Vec::new(),
|
||||
qself: None,
|
||||
path: path,
|
||||
path,
|
||||
};
|
||||
deserialize_with.set_if_none(expr);
|
||||
} else if is_cow(&field.ty, is_slice_u8) {
|
||||
@@ -1400,7 +1397,7 @@ impl Field {
|
||||
let expr = syn::ExprPath {
|
||||
attrs: Vec::new(),
|
||||
qself: None,
|
||||
path: path,
|
||||
path,
|
||||
};
|
||||
deserialize_with.set_if_none(expr);
|
||||
}
|
||||
@@ -1420,7 +1417,7 @@ impl Field {
|
||||
deserialize_with: deserialize_with.get(),
|
||||
ser_bound: ser_bound.get(),
|
||||
de_bound: de_bound.get(),
|
||||
borrowed_lifetimes: borrowed_lifetimes,
|
||||
borrowed_lifetimes,
|
||||
getter: getter.get(),
|
||||
flatten: flatten.get(),
|
||||
transparent: false,
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
clippy::cognitive_complexity,
|
||||
clippy::enum_variant_names,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::redundant_field_names,
|
||||
clippy::too_many_arguments,
|
||||
clippy::trivially_copy_pass_by_ref,
|
||||
clippy::used_underscore_binding,
|
||||
|
||||
+10
-13
@@ -106,10 +106,10 @@ impl Parameters {
|
||||
let generics = build_generics(cont);
|
||||
|
||||
Parameters {
|
||||
self_var: self_var,
|
||||
this: this,
|
||||
generics: generics,
|
||||
is_remote: is_remote,
|
||||
self_var,
|
||||
this,
|
||||
generics,
|
||||
is_remote,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,17 +538,17 @@ fn serialize_externally_tagged_variant(
|
||||
}
|
||||
Style::Tuple => serialize_tuple_variant(
|
||||
TupleVariant::ExternallyTagged {
|
||||
type_name: type_name,
|
||||
variant_index: variant_index,
|
||||
variant_name: variant_name,
|
||||
type_name,
|
||||
variant_index,
|
||||
variant_name,
|
||||
},
|
||||
params,
|
||||
&variant.fields,
|
||||
),
|
||||
Style::Struct => serialize_struct_variant(
|
||||
StructVariant::ExternallyTagged {
|
||||
variant_index: variant_index,
|
||||
variant_name: variant_name,
|
||||
variant_index,
|
||||
variant_name,
|
||||
},
|
||||
params,
|
||||
&variant.fields,
|
||||
@@ -614,10 +614,7 @@ fn serialize_internally_tagged_variant(
|
||||
}
|
||||
}
|
||||
Style::Struct => serialize_struct_variant(
|
||||
StructVariant::InternallyTagged {
|
||||
tag: tag,
|
||||
variant_name: variant_name,
|
||||
},
|
||||
StructVariant::InternallyTagged { tag, variant_name },
|
||||
params,
|
||||
&variant.fields,
|
||||
&type_name,
|
||||
|
||||
Reference in New Issue
Block a user