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 54267dd commit 00adbb2Copy full SHA for 00adbb2
compiler/rustc_errors/src/json.rs
@@ -148,11 +148,12 @@ impl JsonEmitter {
148
149
fn emit(&mut self, val: EmitTyped<'_>) -> io::Result<()> {
150
if self.pretty {
151
- writeln!(self.dst, "{}", serde_json::to_string_pretty(&val).unwrap())
+ serde_json::to_writer_pretty(&mut *self.dst, &val)?
152
} else {
153
- writeln!(self.dst, "{}", serde_json::to_string(&val).unwrap())
154
- }
155
- .and_then(|_| self.dst.flush())
+ serde_json::to_writer(&mut *self.dst, &val)?
+ };
+ self.dst.write_all(b"\n")?;
156
+ self.dst.flush()
157
}
158
159
0 commit comments