@@ -51,8 +51,7 @@ use std::collections::TreeMap;
51
51
use stats:: Stats ;
52
52
use getopts:: { OptGroup , optflag, optopt} ;
53
53
use regex:: Regex ;
54
- use serialize:: { json, Decodable } ;
55
- use serialize:: json:: { Json , ToJson } ;
54
+ use serialize:: { json, Decodable , Encodable } ;
56
55
use term:: Terminal ;
57
56
use term:: color:: { Color , RED , YELLOW , GREEN , CYAN } ;
58
57
@@ -1100,17 +1099,6 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
1100
1099
}
1101
1100
}
1102
1101
1103
-
1104
- impl ToJson for Metric {
1105
- fn to_json ( & self ) -> json:: Json {
1106
- let mut map = TreeMap :: new ( ) ;
1107
- map. insert ( "value" . to_string ( ) , json:: Json :: F64 ( self . value ) ) ;
1108
- map. insert ( "noise" . to_string ( ) , json:: Json :: F64 ( self . noise ) ) ;
1109
- json:: Json :: Object ( map)
1110
- }
1111
- }
1112
-
1113
-
1114
1102
impl MetricMap {
1115
1103
1116
1104
pub fn new ( ) -> MetricMap {
@@ -1138,14 +1126,8 @@ impl MetricMap {
1138
1126
pub fn save ( & self , p : & Path ) -> io:: IoResult < ( ) > {
1139
1127
let mut file = try!( File :: create ( p) ) ;
1140
1128
let MetricMap ( ref map) = * self ;
1141
-
1142
- // FIXME(pcwalton): Yuck.
1143
- let mut new_map = TreeMap :: new ( ) ;
1144
- for ( ref key, ref value) in map. iter ( ) {
1145
- new_map. insert ( key. to_string ( ) , ( * value) . clone ( ) ) ;
1146
- }
1147
-
1148
- new_map. to_json ( ) . to_pretty_writer ( & mut file)
1129
+ let mut enc = json:: PrettyEncoder :: new ( & mut file) ;
1130
+ map. encode ( & mut enc)
1149
1131
}
1150
1132
1151
1133
/// Compare against another MetricMap. Optionally compare all
0 commit comments