mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-23 14:11:04 +00:00
Touch up PR 2567
This commit is contained in:
@@ -1268,7 +1268,7 @@ fn prepare_enum_variant_enum(variants: &[Variant]) -> (TokenStream, Stmts) {
|
|||||||
|
|
||||||
let variant_visitor = Stmts(deserialize_generated_identifier(
|
let variant_visitor = Stmts(deserialize_generated_identifier(
|
||||||
&variant_names_idents,
|
&variant_names_idents,
|
||||||
false, // variant identifiers does not depend on the presence of flatten fields
|
false, // variant identifiers do not depend on the presence of flatten fields
|
||||||
true,
|
true,
|
||||||
None,
|
None,
|
||||||
fallthrough,
|
fallthrough,
|
||||||
@@ -2708,7 +2708,7 @@ fn deserialize_map_in_place(
|
|||||||
) -> Fragment {
|
) -> Fragment {
|
||||||
assert!(
|
assert!(
|
||||||
!cattrs.has_flatten(),
|
!cattrs.has_flatten(),
|
||||||
"inplace deserialization of maps doesn't support flatten fields"
|
"inplace deserialization of maps does not support flatten fields"
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create the field names for the fields.
|
// Create the field names for the fields.
|
||||||
|
|||||||
@@ -216,9 +216,9 @@ pub struct Container {
|
|||||||
type_into: Option<syn::Type>,
|
type_into: Option<syn::Type>,
|
||||||
remote: Option<syn::Path>,
|
remote: Option<syn::Path>,
|
||||||
identifier: Identifier,
|
identifier: Identifier,
|
||||||
/// `true` if container is a `struct` and it has a field with `#[serde(flatten)]`
|
/// True if container is a struct and has a field with `#[serde(flatten)]`,
|
||||||
/// attribute or it is an `enum` with a struct variant which has a field with
|
/// or is an enum with a struct variant which has a field with
|
||||||
/// `#[serde(flatten)]` attribute. Examples:
|
/// `#[serde(flatten)]`.
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// struct Container {
|
/// struct Container {
|
||||||
@@ -810,8 +810,8 @@ pub struct Variant {
|
|||||||
rename_all_rules: RenameAllRules,
|
rename_all_rules: RenameAllRules,
|
||||||
ser_bound: Option<Vec<syn::WherePredicate>>,
|
ser_bound: Option<Vec<syn::WherePredicate>>,
|
||||||
de_bound: Option<Vec<syn::WherePredicate>>,
|
de_bound: Option<Vec<syn::WherePredicate>>,
|
||||||
/// `true` if variant is a struct variant which contains a field with `#[serde(flatten)]`
|
/// True if variant is a struct variant which contains a field with
|
||||||
/// attribute. Examples:
|
/// `#[serde(flatten)]`.
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// enum Enum {
|
/// enum Enum {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#![allow(dead_code)] // we do not read enum fields
|
#![allow(dead_code)] // we do not read enum fields
|
||||||
|
|
||||||
use serde_derive::Deserialize;
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#![allow(dead_code)] // we do not read enum fields
|
#![allow(dead_code)] // we do not read enum fields
|
||||||
|
|
||||||
use serde_derive::Deserialize;
|
use serde_derive::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
@@ -12,5 +13,6 @@ pub enum A {
|
|||||||
e: E,
|
e: E,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct E {}
|
pub struct E {}
|
||||||
|
|||||||
Reference in New Issue
Block a user