aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-02-21 09:31:19 -0600
committerGitHub <noreply@github.com>2017-02-21 09:31:19 -0600
commit3b7494cf501c6e18b249977c7f0d56654c5e381c (patch)
treeb790a14f736dccab35df88a45007b5a9943193c2 /src
parentb02e9b9a4a0a074f1de6f3b954caafafd3b3c325 (diff)
parent2e71aaf8f63887ac07bb3764c40ff0a8ba1f7f2a (diff)
downloadmilf-rs-3b7494cf501c6e18b249977c7f0d56654c5e381c.tar.gz
milf-rs-3b7494cf501c6e18b249977c7f0d56654c5e381c.zip
Merge pull request #151 from EPashkin/fix_table_values_sorting
Fixed sorting of table values
Diffstat (limited to 'src')
-rw-r--r--src/value.rs4
1 files changed, 2 insertions, 2 deletions
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)?;
}
}