Adressed concerns raised by @oli-obk.

Specifically:
 - Change identation in `de.rs`.
 - Make `attr::Field` take a `attr::Default` as opposed to the entire parent `attr::Container`.
This commit is contained in:
Jeroen Bollen
2017-12-08 15:13:05 +01:00
parent c887a0b472
commit aa86b04714
3 changed files with 23 additions and 20 deletions
+2 -2
View File
@@ -719,7 +719,7 @@ impl Field {
index: usize,
field: &syn::Field,
attrs: Option<&Variant>,
container: &Container,
container_default: &Default,
) -> Self {
let mut ser_name = Attr::none(cx, "rename");
let mut de_name = Attr::none(cx, "rename");
@@ -890,7 +890,7 @@ impl Field {
// Is skip_deserializing, initialize the field to Default::default() unless a different
// default is specified by `#[serde(default = "...")]` on ourselves or our container (e.g.
// the struct we are in).
if container.default == Default::None && skip_deserializing.0.value.is_some() {
if container_default == &Default::None && skip_deserializing.0.value.is_some() {
default.set_if_none(Default::Default);
}