mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
auto merge of #8312 : alexcrichton/rust/use-treemap, r=erickt
Closes #4430
This commit is contained in:
+1
-18
@@ -26,7 +26,6 @@
|
||||
|
||||
use serialize::Encodable;
|
||||
use serialize;
|
||||
use sort::Sort;
|
||||
use treemap::TreeMap;
|
||||
|
||||
/// Represents a json value
|
||||
@@ -1152,23 +1151,7 @@ fn lt(&self, other: &Json) -> bool {
|
||||
Object(ref d0) => {
|
||||
match *other {
|
||||
Number(_) | String(_) | Boolean(_) | List(_) => false,
|
||||
Object(ref d1) => {
|
||||
let mut d0_flat = ~[];
|
||||
let mut d1_flat = ~[];
|
||||
|
||||
// FIXME #4430: this is horribly inefficient...
|
||||
for (k, v) in d0.iter() {
|
||||
d0_flat.push((@(*k).clone(), @(*v).clone()));
|
||||
}
|
||||
d0_flat.qsort();
|
||||
|
||||
for (k, v) in d1.iter() {
|
||||
d1_flat.push((@(*k).clone(), @(*v).clone()));
|
||||
}
|
||||
d1_flat.qsort();
|
||||
|
||||
d0_flat < d1_flat
|
||||
}
|
||||
Object(ref d1) => d0 < d1,
|
||||
Null => true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user