From e5ed440136810e1f53bc0164698a49825d9f330b Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 25 Mar 2018 12:32:06 +0200 Subject: [PATCH] Always check flatten assertions --- serde_derive/src/de.rs | 10 +++++----- serde_derive_internals/src/check.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index 456773a8..7bfb8e56 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -349,7 +349,7 @@ fn deserialize_tuple( split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); - debug_assert!(!cattrs.has_flatten()); + assert!(!cattrs.has_flatten()); // If there are getters (implying private fields), construct the local type // and use an `Into` conversion to get the remote type. If there are no @@ -446,7 +446,7 @@ fn deserialize_tuple_in_place( split_with_de_lifetime(params); let delife = params.borrowed.de_lifetime(); - debug_assert!(!cattrs.has_flatten()); + assert!(!cattrs.has_flatten()); let is_enum = variant_ident.is_some(); let expecting = match variant_ident { @@ -2104,7 +2104,7 @@ fn deserialize_struct_as_struct_visitor( fields: &[Field], cattrs: &attr::Container, ) -> (Fragment, Option, Fragment) { - debug_assert!(!cattrs.has_flatten()); + assert!(!cattrs.has_flatten()); let field_names_idents: Vec<_> = fields .iter() @@ -2354,7 +2354,7 @@ fn deserialize_struct_as_struct_in_place_visitor( fields: &[Field], cattrs: &attr::Container, ) -> (Fragment, Option, Fragment) { - debug_assert!(!cattrs.has_flatten()); + assert!(!cattrs.has_flatten()); let field_names_idents: Vec<_> = fields .iter() @@ -2383,7 +2383,7 @@ fn deserialize_map_in_place( fields: &[Field], cattrs: &attr::Container, ) -> Fragment { - debug_assert!(!cattrs.has_flatten()); + assert!(!cattrs.has_flatten()); // Create the field names for the fields. let fields_names: Vec<_> = fields diff --git a/serde_derive_internals/src/check.rs b/serde_derive_internals/src/check.rs index dd37085d..31980a39 100644 --- a/serde_derive_internals/src/check.rs +++ b/serde_derive_internals/src/check.rs @@ -45,7 +45,7 @@ fn check_getter(cx: &Ctxt, cont: &Container) { fn check_flatten(cx: &Ctxt, cont: &Container) { match cont.data { Data::Enum(_) => { - debug_assert!(!cont.attrs.has_flatten()); + assert!(!cont.attrs.has_flatten()); } Data::Struct(_, _) => { for field in cont.data.all_fields() {