@@ -28,7 +28,7 @@ use std::path::Path;
28
28
use std:: sync:: { Arc , Mutex } ;
29
29
use std:: vec;
30
30
31
- use rustc_serialize :: json :: { as_json , as_pretty_json } ;
31
+ use serde :: Serialize ;
32
32
33
33
#[ cfg( test) ]
34
34
mod tests;
@@ -126,9 +126,9 @@ impl Emitter for JsonEmitter {
126
126
fn emit_diagnostic ( & mut self , diag : & crate :: Diagnostic ) {
127
127
let data = Diagnostic :: from_errors_diagnostic ( diag, self ) ;
128
128
let result = if self . pretty {
129
- writeln ! ( & mut self . dst, "{}" , as_pretty_json ( & data) )
129
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string_pretty ( & data) . unwrap ( ) )
130
130
} else {
131
- writeln ! ( & mut self . dst, "{}" , as_json ( & data) )
131
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string ( & data) . unwrap ( ) )
132
132
}
133
133
. and_then ( |_| self . dst . flush ( ) ) ;
134
134
if let Err ( e) = result {
@@ -139,9 +139,9 @@ impl Emitter for JsonEmitter {
139
139
fn emit_artifact_notification ( & mut self , path : & Path , artifact_type : & str ) {
140
140
let data = ArtifactNotification { artifact : path, emit : artifact_type } ;
141
141
let result = if self . pretty {
142
- writeln ! ( & mut self . dst, "{}" , as_pretty_json ( & data) )
142
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string_pretty ( & data) . unwrap ( ) )
143
143
} else {
144
- writeln ! ( & mut self . dst, "{}" , as_json ( & data) )
144
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string ( & data) . unwrap ( ) )
145
145
}
146
146
. and_then ( |_| self . dst . flush ( ) ) ;
147
147
if let Err ( e) = result {
@@ -161,9 +161,9 @@ impl Emitter for JsonEmitter {
161
161
. collect ( ) ;
162
162
let report = FutureIncompatReport { future_incompat_report : data } ;
163
163
let result = if self . pretty {
164
- writeln ! ( & mut self . dst, "{}" , as_pretty_json ( & report) )
164
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string_pretty ( & report) . unwrap ( ) )
165
165
} else {
166
- writeln ! ( & mut self . dst, "{}" , as_json ( & report) )
166
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string ( & report) . unwrap ( ) )
167
167
}
168
168
. and_then ( |_| self . dst . flush ( ) ) ;
169
169
if let Err ( e) = result {
@@ -175,9 +175,9 @@ impl Emitter for JsonEmitter {
175
175
let lint_level = lint_level. as_str ( ) ;
176
176
let data = UnusedExterns { lint_level, unused_extern_names : unused_externs } ;
177
177
let result = if self . pretty {
178
- writeln ! ( & mut self . dst, "{}" , as_pretty_json ( & data) )
178
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string_pretty ( & data) . unwrap ( ) )
179
179
} else {
180
- writeln ! ( & mut self . dst, "{}" , as_json ( & data) )
180
+ writeln ! ( & mut self . dst, "{}" , serde_json :: to_string ( & data) . unwrap ( ) )
181
181
}
182
182
. and_then ( |_| self . dst . flush ( ) ) ;
183
183
if let Err ( e) = result {
@@ -204,7 +204,7 @@ impl Emitter for JsonEmitter {
204
204
205
205
// The following data types are provided just for serialisation.
206
206
207
- #[ derive( Encodable ) ]
207
+ #[ derive( Serialize ) ]
208
208
struct Diagnostic {
209
209
/// The primary error message.
210
210
message : String ,
@@ -218,7 +218,7 @@ struct Diagnostic {
218
218
rendered : Option < String > ,
219
219
}
220
220
221
- #[ derive( Encodable ) ]
221
+ #[ derive( Serialize ) ]
222
222
struct DiagnosticSpan {
223
223
file_name : String ,
224
224
byte_start : u32 ,
@@ -245,7 +245,7 @@ struct DiagnosticSpan {
245
245
expansion : Option < Box < DiagnosticSpanMacroExpansion > > ,
246
246
}
247
247
248
- #[ derive( Encodable ) ]
248
+ #[ derive( Serialize ) ]
249
249
struct DiagnosticSpanLine {
250
250
text : String ,
251
251
@@ -255,7 +255,7 @@ struct DiagnosticSpanLine {
255
255
highlight_end : usize ,
256
256
}
257
257
258
- #[ derive( Encodable ) ]
258
+ #[ derive( Serialize ) ]
259
259
struct DiagnosticSpanMacroExpansion {
260
260
/// span where macro was applied to generate this code; note that
261
261
/// this may itself derive from a macro (if
@@ -269,28 +269,28 @@ struct DiagnosticSpanMacroExpansion {
269
269
def_site_span : DiagnosticSpan ,
270
270
}
271
271
272
- #[ derive( Encodable ) ]
272
+ #[ derive( Serialize ) ]
273
273
struct DiagnosticCode {
274
274
/// The code itself.
275
275
code : String ,
276
276
/// An explanation for the code.
277
277
explanation : Option < & ' static str > ,
278
278
}
279
279
280
- #[ derive( Encodable ) ]
280
+ #[ derive( Serialize ) ]
281
281
struct ArtifactNotification < ' a > {
282
282
/// The path of the artifact.
283
283
artifact : & ' a Path ,
284
284
/// What kind of artifact we're emitting.
285
285
emit : & ' a str ,
286
286
}
287
287
288
- #[ derive( Encodable ) ]
288
+ #[ derive( Serialize ) ]
289
289
struct FutureBreakageItem {
290
290
diagnostic : Diagnostic ,
291
291
}
292
292
293
- #[ derive( Encodable ) ]
293
+ #[ derive( Serialize ) ]
294
294
struct FutureIncompatReport {
295
295
future_incompat_report : Vec < FutureBreakageItem > ,
296
296
}
@@ -299,7 +299,7 @@ struct FutureIncompatReport {
299
299
// doctest component (as well as cargo).
300
300
// We could unify this struct the one in rustdoc but they have different
301
301
// ownership semantics, so doing so would create wasteful allocations.
302
- #[ derive( Encodable ) ]
302
+ #[ derive( Serialize ) ]
303
303
struct UnusedExterns < ' a , ' b , ' c > {
304
304
/// The severity level of the unused dependencies lint
305
305
lint_level : & ' a str ,
0 commit comments