We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c070a83 commit 4854e19Copy full SHA for 4854e19
compiler/rustc_errors/src/json.rs
@@ -141,11 +141,11 @@ impl JsonEmitter {
141
142
fn emit(&mut self, val: EmitTyped<'_>) -> io::Result<()> {
143
if self.pretty {
144
- writeln!(self.dst, "{}", serde_json::to_string_pretty(&val).unwrap())
+ serde_json::to_writer_pretty(&mut *self.dst, &val)?
145
} else {
146
- writeln!(self.dst, "{}", serde_json::to_string(&val).unwrap())
147
- }
148
- .and_then(|_| self.dst.flush())
+ serde_json::to_writer(&mut *self.dst, &val)?
+ };
+ self.dst.flush()
149
}
150
151
0 commit comments