mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 23:35:26 +00:00
Skip another clone of the fallthrough arm
This commit is contained in:
parent
18e5b03fd1
commit
e24dbc418d
@ -2141,28 +2141,33 @@ fn deserialize_identifier(
|
|||||||
(None, None, None, None)
|
(None, None, None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
let fallthrough_arm = if let Some(fallthrough) = fallthrough.clone() {
|
let fallthrough_arm_tokens;
|
||||||
|
let fallthrough_arm = if let Some(fallthrough) = &fallthrough {
|
||||||
fallthrough
|
fallthrough
|
||||||
} else if is_variant {
|
} else if is_variant {
|
||||||
quote! {
|
fallthrough_arm_tokens = quote! {
|
||||||
_serde::__private::Err(_serde::de::Error::unknown_variant(__value, VARIANTS))
|
_serde::__private::Err(_serde::de::Error::unknown_variant(__value, VARIANTS))
|
||||||
}
|
};
|
||||||
|
&fallthrough_arm_tokens
|
||||||
} else {
|
} else {
|
||||||
quote! {
|
fallthrough_arm_tokens = quote! {
|
||||||
_serde::__private::Err(_serde::de::Error::unknown_field(__value, FIELDS))
|
_serde::__private::Err(_serde::de::Error::unknown_field(__value, FIELDS))
|
||||||
}
|
};
|
||||||
|
&fallthrough_arm_tokens
|
||||||
};
|
};
|
||||||
|
|
||||||
let u64_fallthrough_arm = if let Some(fallthrough) = fallthrough {
|
let u64_fallthrough_arm_tokens;
|
||||||
|
let u64_fallthrough_arm = if let Some(fallthrough) = &fallthrough {
|
||||||
fallthrough
|
fallthrough
|
||||||
} else {
|
} else {
|
||||||
let fallthrough_msg = format!("{} index 0 <= i < {}", index_expecting, fields.len());
|
let fallthrough_msg = format!("{} index 0 <= i < {}", index_expecting, fields.len());
|
||||||
quote! {
|
u64_fallthrough_arm_tokens = quote! {
|
||||||
_serde::__private::Err(_serde::de::Error::invalid_value(
|
_serde::__private::Err(_serde::de::Error::invalid_value(
|
||||||
_serde::de::Unexpected::Unsigned(__value),
|
_serde::de::Unexpected::Unsigned(__value),
|
||||||
&#fallthrough_msg,
|
&#fallthrough_msg,
|
||||||
))
|
))
|
||||||
}
|
};
|
||||||
|
&u64_fallthrough_arm_tokens
|
||||||
};
|
};
|
||||||
|
|
||||||
let variant_indices = 0_u64..;
|
let variant_indices = 0_u64..;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user