Skip to content

Commit

Permalink
imp(upgrade): use serde 0.9.8 and Map::Entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 22, 2017
1 parent 727ed22 commit 6092375
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ categories = ["algorithms"]
license = "MIT/Apache-2.0"
name = "treediff"
repository = "https://github.com/Byron/treediff-rs"
version = "2.5.0"
version = "2.5.1"

[dependencies]
rustc-serialize = {version = "0.3.22", optional = true}
serde_json = {version = "0.9", optional = true}
serde_json = {version = "0.9.8", optional = true}
serde_yaml = {version = "0.6", optional = true}
yaml-rust = {version = "0.3", optional = true}

Expand Down
20 changes: 10 additions & 10 deletions src/value/serde_json.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use traitdef::{Mutable, Value};
use super::Key;
use serde_json::{Map, Value as SerdeJson};
use serde_json::{Map, Value as SerdeJson, map};
use std::mem;

impl Value for SerdeJson {
Expand Down Expand Up @@ -65,16 +65,16 @@ impl Mutable for SerdeJson {
c
} {
&mut SerdeJson::Object(ref mut obj) => {
if obj.contains_key(k) {
let obj = obj.get_mut(k).expect("map to work");
if i == last_key_index {
*obj = v.clone();
return;
match obj.entry(k.clone()) {
map::Entry::Vacant(e) => e.insert(object_or_value(i)),
map::Entry::Occupied(e) => {
if i == last_key_index {
*e.into_mut() = v.clone();
return;
} else {
e.into_mut()
}
}
obj
} else {
obj.insert(k.clone(), object_or_value(i));
obj.get_mut(k).expect("map to work")
}
}
c @ &mut SerdeJson::String(_) |
Expand Down

0 comments on commit 6092375

Please sign in to comment.