Skip to content

Commit b1353a9

Browse files
authored
Merge pull request #2856 from dtolnay/dename
Produce a separate warning for every colliding name
2 parents 7f1e697 + c59e876 commit b1353a9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

serde_derive/src/de.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,11 @@ fn deserialize_identifier(
22172217
let ident = &field.ident;
22182218
let aliases = field.aliases;
22192219
// `aliases` also contains a main name
2220-
quote!(#(#aliases)|* => _serde::__private::Ok(#this_value::#ident))
2220+
quote! {
2221+
#(
2222+
#aliases => _serde::__private::Ok(#this_value::#ident),
2223+
)*
2224+
}
22212225
});
22222226
let bytes_mapping = deserialized_fields.iter().map(|field| {
22232227
let ident = &field.ident;
@@ -2226,7 +2230,11 @@ fn deserialize_identifier(
22262230
.aliases
22272231
.iter()
22282232
.map(|alias| Literal::byte_string(alias.value.as_bytes()));
2229-
quote!(#(#aliases)|* => _serde::__private::Ok(#this_value::#ident))
2233+
quote! {
2234+
#(
2235+
#aliases => _serde::__private::Ok(#this_value::#ident),
2236+
)*
2237+
}
22302238
});
22312239

22322240
let expecting = expecting.unwrap_or(if is_variant {
@@ -2424,7 +2432,7 @@ fn deserialize_identifier(
24242432
__E: _serde::de::Error,
24252433
{
24262434
match __value {
2427-
#(#str_mapping,)*
2435+
#(#str_mapping)*
24282436
_ => {
24292437
#value_as_borrowed_str_content
24302438
#fallthrough_borrowed_arm
@@ -2437,7 +2445,7 @@ fn deserialize_identifier(
24372445
__E: _serde::de::Error,
24382446
{
24392447
match __value {
2440-
#(#bytes_mapping,)*
2448+
#(#bytes_mapping)*
24412449
_ => {
24422450
#bytes_to_str
24432451
#value_as_borrowed_bytes_content
@@ -2462,7 +2470,7 @@ fn deserialize_identifier(
24622470
__E: _serde::de::Error,
24632471
{
24642472
match __value {
2465-
#(#str_mapping,)*
2473+
#(#str_mapping)*
24662474
_ => {
24672475
#value_as_str_content
24682476
#fallthrough_arm
@@ -2475,7 +2483,7 @@ fn deserialize_identifier(
24752483
__E: _serde::de::Error,
24762484
{
24772485
match __value {
2478-
#(#bytes_mapping,)*
2486+
#(#bytes_mapping)*
24792487
_ => {
24802488
#bytes_to_str
24812489
#value_as_bytes_content

0 commit comments

Comments
 (0)