@@ -408,18 +408,17 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
408
408
// "crate": { parsed crate ... },
409
409
// "plugins": { output of plugins ... }
410
410
// }
411
- let mut json = box std:: collections:: TreeMap :: new ( ) ;
412
- json. insert ( "schema" . to_string ( ) ,
413
- json:: String ( SCHEMA_VERSION . to_string ( ) ) ) ;
414
- let plugins_json = box res. move_iter ( )
415
- . filter_map ( |opt| {
416
- match opt {
417
- None => None ,
418
- Some ( ( string, json) ) => {
419
- Some ( ( string. to_string ( ) , json) )
420
- }
411
+ let mut json = std:: collections:: TreeMap :: new ( ) ;
412
+ json. insert ( "schema" . to_string ( ) , json:: String ( SCHEMA_VERSION . to_string ( ) ) ) ;
413
+ let plugins_json = res. move_iter ( )
414
+ . filter_map ( |opt| {
415
+ match opt {
416
+ None => None ,
417
+ Some ( ( string, json) ) => {
418
+ Some ( ( string. to_string ( ) , json) )
421
419
}
422
- } ) . collect ( ) ;
420
+ }
421
+ } ) . collect ( ) ;
423
422
424
423
// FIXME #8335: yuck, Rust -> str -> JSON round trip! No way to .encode
425
424
// straight to the Rust JSON representation.
@@ -429,7 +428,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
429
428
let mut encoder = json:: Encoder :: new ( & mut w as & mut io:: Writer ) ;
430
429
krate. encode ( & mut encoder) . unwrap ( ) ;
431
430
}
432
- str:: from_utf8 ( w. unwrap ( ) . as_slice ( ) ) . unwrap ( ) . to_string ( )
431
+ str:: from_utf8_owned ( w. unwrap ( ) ) . unwrap ( )
433
432
} ;
434
433
let crate_json = match json:: from_str ( crate_json_str. as_slice ( ) ) {
435
434
Ok ( j) => j,
@@ -440,6 +439,5 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> ,
440
439
json. insert ( "plugins" . to_string ( ) , json:: Object ( plugins_json) ) ;
441
440
442
441
let mut file = try!( File :: create ( & dst) ) ;
443
- try!( json:: Object ( json) . to_writer ( & mut file) ) ;
444
- Ok ( ( ) )
442
+ json:: Object ( json) . to_writer ( & mut file)
445
443
}
0 commit comments