Skip to content

Commit b72f365

Browse files
committed
Use serde_json::to_writer directly
1 parent e0ec4ff commit b72f365

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/librustc_save_analysis/json_dumper.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,8 @@ pub struct WriteOutput<'b, W: Write> {
2929

3030
impl<'b, W: Write> DumpOutput for WriteOutput<'b, W> {
3131
fn dump(&mut self, result: &Analysis) {
32-
let json = match serde_json::to_string(result) {
33-
Ok(json) => json,
34-
Err(e) => {
35-
error!("Can't serialize save-analysis: {}", e);
36-
return;
37-
}
38-
};
39-
40-
if let Err(e) = write!(self.output, "{}", json) {
41-
error!("Error writing save-analysis: {:?}", e);
32+
if let Err(e) = serde_json::to_writer(self.output.by_ref(), result) {
33+
error!("Can't serialize save-analysis: {:?}", e);
4234
}
4335
}
4436
}

0 commit comments

Comments
 (0)