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 537b5b3Copy full SHA for 537b5b3
compiler/rustc_errors/src/json.rs
@@ -141,11 +141,12 @@ 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.write_all(b"\n")?;
149
+ self.dst.flush()
150
}
151
152
0 commit comments