Skip to content

Commit

Permalink
clean up json benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Apr 8, 2018
1 parent fb11984 commit c459cc5
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions benches/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,21 @@ named!(
separated_list!(char!(','), key_value),
char!('}')
),
|tuple_vec| {
tuple_vec
.into_iter()
.map(|(k, v)| (String::from(k), v))
.collect()
/*let mut h: HashMap<String, JsonValue> = HashMap::new();
for (k, v) in tuple_vec {
h.insert(String::from(k), v);
}
h*/
}
|tuple_vec| tuple_vec
.into_iter()
.map(|(k, v)| (String::from(k), v))
.collect()
))
);

named!(
value<JsonValue>,
ws!(alt!(
hash => { |h| JsonValue::Object(h) } |
array => { |v| JsonValue::Array(v) } |
string => { |s| JsonValue::Str(String::from(s)) } |
float => { |num| JsonValue::Num(num) }
hash => { |h| JsonValue::Object(h) } |
array => { |v| JsonValue::Array(v) } |
string => { |s| JsonValue::Str(String::from(s)) } |
float => { |f| JsonValue::Num(f) } |
boolean => { |b| JsonValue::Boolean(b) }
))
);

Expand Down

0 comments on commit c459cc5

Please sign in to comment.