File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ mod conversions;
88
99use std:: cell:: RefCell ;
1010use std:: fs:: { create_dir_all, File } ;
11+ use std:: io:: { BufWriter , Write } ;
1112use std:: path:: PathBuf ;
1213use std:: rc:: Rc ;
1314
@@ -213,7 +214,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
213214 let mut index = ( * self . index ) . clone ( ) . into_inner ( ) ;
214215 index. extend ( self . get_trait_items ( ) ) ;
215216 // This needs to be the default HashMap for compatibility with the public interface for
216- // rustdoc-json
217+ // rustdoc-json-types
217218 #[ allow( rustc:: default_hash_types) ]
218219 let output = types:: Crate {
219220 root : types:: Id ( String :: from ( "0:0" ) ) ,
@@ -263,8 +264,10 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
263264 let mut p = out_dir;
264265 p. push ( output. index . get ( & output. root ) . unwrap ( ) . name . clone ( ) . unwrap ( ) ) ;
265266 p. set_extension ( "json" ) ;
266- let file = try_err ! ( File :: create( & p) , p) ;
267- serde_json:: ser:: to_writer ( & file, & output) . unwrap ( ) ;
267+ let mut file = BufWriter :: new ( try_err ! ( File :: create( & p) , p) ) ;
268+ serde_json:: ser:: to_writer ( & mut file, & output) . unwrap ( ) ;
269+ try_err ! ( file. flush( ) , p) ;
270+
268271 Ok ( ( ) )
269272 }
270273
You can’t perform that action at this time.
0 commit comments