File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ mod conversions;
8
8
9
9
use std:: cell:: RefCell ;
10
10
use std:: fs:: { create_dir_all, File } ;
11
+ use std:: io:: { BufWriter , Write } ;
11
12
use std:: path:: PathBuf ;
12
13
use std:: rc:: Rc ;
13
14
@@ -213,7 +214,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
213
214
let mut index = ( * self . index ) . clone ( ) . into_inner ( ) ;
214
215
index. extend ( self . get_trait_items ( ) ) ;
215
216
// This needs to be the default HashMap for compatibility with the public interface for
216
- // rustdoc-json
217
+ // rustdoc-json-types
217
218
#[ allow( rustc:: default_hash_types) ]
218
219
let output = types:: Crate {
219
220
root : types:: Id ( String :: from ( "0:0" ) ) ,
@@ -263,8 +264,10 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
263
264
let mut p = out_dir;
264
265
p. push ( output. index . get ( & output. root ) . unwrap ( ) . name . clone ( ) . unwrap ( ) ) ;
265
266
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
+
268
271
Ok ( ( ) )
269
272
}
270
273
You can’t perform that action at this time.
0 commit comments