Always check flatten assertions

This commit is contained in:
David Tolnay 2018-03-25 12:32:06 +02:00
parent d45ca2f5e4
commit e5ed440136
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 6 additions and 6 deletions

View File

@ -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>, 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>, 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

View File

@ -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() {