diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index ef85385f6..b87ababf0 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -1268,7 +1268,7 @@ fn prepare_enum_variant_enum(variants: &[Variant]) -> (TokenStream, Stmts) { let variant_visitor = Stmts(deserialize_generated_identifier( &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, None, fallthrough, @@ -2708,7 +2708,7 @@ fn deserialize_map_in_place( ) -> Fragment { assert!( !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. diff --git a/serde_derive/src/internals/attr.rs b/serde_derive/src/internals/attr.rs index 5064d079a..ba3a2d8d8 100644 --- a/serde_derive/src/internals/attr.rs +++ b/serde_derive/src/internals/attr.rs @@ -216,9 +216,9 @@ pub struct Container { type_into: Option, remote: Option, identifier: Identifier, - /// `true` if container is a `struct` and it has a field with `#[serde(flatten)]` - /// attribute or it is an `enum` with a struct variant which has a field with - /// `#[serde(flatten)]` attribute. Examples: + /// True if container is a struct and has a field with `#[serde(flatten)]`, + /// or is an enum with a struct variant which has a field with + /// `#[serde(flatten)]`. /// /// ```ignore /// struct Container { @@ -810,8 +810,8 @@ pub struct Variant { rename_all_rules: RenameAllRules, ser_bound: Option>, de_bound: Option>, - /// `true` if variant is a struct variant which contains a field with `#[serde(flatten)]` - /// attribute. Examples: + /// True if variant is a struct variant which contains a field with + /// `#[serde(flatten)]`. /// /// ```ignore /// enum Enum { diff --git a/test_suite/tests/regression/issue1904.rs b/test_suite/tests/regression/issue1904.rs index 99736c078..b1d5c7314 100644 --- a/test_suite/tests/regression/issue1904.rs +++ b/test_suite/tests/regression/issue1904.rs @@ -1,4 +1,5 @@ #![allow(dead_code)] // we do not read enum fields + use serde_derive::Deserialize; #[derive(Deserialize)] diff --git a/test_suite/tests/regression/issue2792.rs b/test_suite/tests/regression/issue2792.rs index 13c0b7103..a8c1604ca 100644 --- a/test_suite/tests/regression/issue2792.rs +++ b/test_suite/tests/regression/issue2792.rs @@ -1,4 +1,5 @@ #![allow(dead_code)] // we do not read enum fields + use serde_derive::Deserialize; #[derive(Deserialize)] @@ -12,5 +13,6 @@ pub enum A { e: E, }, } + #[derive(Deserialize)] pub struct E {}