mirror of
https://github.com/serde-rs/json.git
synced 2026-03-19 08:09:49 +00:00
Simplify the implementation of str's index_or_insert
This commit is contained in:
@@ -109,9 +109,7 @@ impl Index for str {
|
||||
}
|
||||
fn index_or_insert<'v>(&self, v: &'v mut Value) -> &'v mut Value {
|
||||
if let Value::Null = *v {
|
||||
let mut map = Map::new();
|
||||
map.insert(self.to_owned(), Value::Null);
|
||||
*v = Value::Object(map);
|
||||
*v = Value::Object(Map::new());
|
||||
}
|
||||
match *v {
|
||||
Value::Object(ref mut map) => {
|
||||
|
||||
Reference in New Issue
Block a user