提交 1e55dce0 编写于 作者: A Adolfo Ochagavía

Removed unnecessary Box

上级 4c65a865
......@@ -246,7 +246,7 @@ pub enum Json {
String(String),
Boolean(bool),
List(List),
Object(Box<Object>),
Object(Object),
Null,
}
......@@ -888,7 +888,7 @@ pub fn is_object<'a>(&'a self) -> bool {
/// Returns None otherwise.
pub fn as_object<'a>(&'a self) -> Option<&'a Object> {
match self {
&Object(ref map) => Some(&**map),
&Object(ref map) => Some(map),
_ => None
}
}
......@@ -1720,7 +1720,7 @@ fn build_list(&mut self) -> Result<Json, BuilderError> {
fn build_object(&mut self) -> Result<Json, BuilderError> {
self.bump();
let mut values = box TreeMap::new();
let mut values = TreeMap::new();
loop {
match self.token {
......@@ -2117,7 +2117,7 @@ fn to_json(&self) -> Json {
for (key, value) in self.iter() {
d.insert((*key).clone(), value.to_json());
}
Object(box d)
Object(d)
}
}
......@@ -2127,7 +2127,7 @@ fn to_json(&self) -> Json {
for (key, value) in self.iter() {
d.insert((*key).clone(), value.to_json());
}
Object(box d)
Object(d)
}
}
......@@ -2185,7 +2185,7 @@ struct Outer {
}
fn mk_object(items: &[(String, Json)]) -> Json {
let mut d = box TreeMap::new();
let mut d = TreeMap::new();
for item in items.iter() {
match *item {
......@@ -3252,7 +3252,7 @@ fn test_to_json() {
let mut tree_map = TreeMap::new();
tree_map.insert("a".to_string(), Number(1.0_f64));
tree_map.insert("b".to_string(), Number(2.0_f64));
Object(box tree_map)
Object(tree_map)
};
assert_eq!(list2.to_json(), list2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册