From 2e71aaf8f63887ac07bb3764c40ff0a8ba1f7f2a Mon Sep 17 00:00:00 2001 From: Evgenii Pashkin Date: Sun, 19 Feb 2017 18:15:58 +0300 Subject: Fixed sorting of table values --- src/value.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/value.rs b/src/value.rs index 4d56023..3a366d8 100644 --- a/src/value.rs +++ b/src/value.rs @@ -367,12 +367,12 @@ impl ser::Serialize for Value { // array-of-tables) as all keys must be emitted first. for (k, v) in t { if !v.is_table() && !v.is_array() || - (v.as_array().map(|a| a.len() == 0).unwrap_or(false)) { + (v.as_array().map(|a| !a.iter().any(|v| v.is_table())).unwrap_or(false)) { map.serialize_entry(k, v)?; } } for (k, v) in t { - if v.as_array().map(|a| a.len() > 0).unwrap_or(false) { + if v.as_array().map(|a| a.iter().any(|v| v.is_table())).unwrap_or(false) { map.serialize_entry(k, v)?; } } -- cgit v1.2.3