diff options
author | David Orchard <if_coding@fastmail.com> | 2021-07-28 23:51:02 -0700 |
---|---|---|
committer | David Orchard <if_coding@fastmail.com> | 2021-08-15 10:31:38 -0700 |
commit | 7134592270190c28e538d580a3d55b0f1ff753f8 (patch) | |
tree | da8d736b8cd4fdc3d4d10bf990851623bb5d61ef /src/path | |
parent | f14adeb0984f81883cd85c6590c960f4dcadb59b (diff) |
Preserve map order when merging
Diffstat (limited to 'src/path')
-rw-r--r-- | src/path/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/path/mod.rs b/src/path/mod.rs index 04c424c..b056467 100644 --- a/src/path/mod.rs +++ b/src/path/mod.rs @@ -209,7 +209,11 @@ impl Expression { _ => { if let ValueKind::Table(ref mut map) = root.kind { // Just do a simple set - map.insert(id.clone(), value); + if let Some(existing) = map.get_mut(id) { + *existing = value; + } else { + map.insert(id.clone(), value); + } } } } |