Skip to content

Commit 4895a99

Browse files
committed
WIP
1 parent 334ba81 commit 4895a99

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/rustc_errors/src/json.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ impl JsonEmitter {
8888
}
8989
}
9090

91-
fn emit(&mut self, val: EmitTyped<'_>) -> io::Result<()> {
91+
fn emit(&mut self, val: &EmitTyped<'_>) -> io::Result<()> {
9292
if self.pretty {
93-
serde_json::to_writer_pretty(&mut *self.dst, &val)?
93+
serde_json::to_writer_pretty(&mut *self.dst, val)?
9494
} else {
95-
serde_json::to_writer(&mut *self.dst, &val)?
95+
serde_json::to_writer(&mut *self.dst, val)?
9696
};
9797
self.dst.write_all(b"\n")?;
9898
self.dst.flush()
@@ -121,15 +121,15 @@ impl Translate for JsonEmitter {
121121
impl Emitter for JsonEmitter {
122122
fn emit_diagnostic(&mut self, diag: crate::DiagInner, registry: &Registry) {
123123
let data = Diagnostic::from_errors_diagnostic(diag, self, registry);
124-
let result = self.emit(EmitTyped::Diagnostic(data));
124+
let result = self.emit(&EmitTyped::Diagnostic(data));
125125
if let Err(e) = result {
126126
panic!("failed to print diagnostics: {e:?}");
127127
}
128128
}
129129

130130
fn emit_artifact_notification(&mut self, path: &Path, artifact_type: &str) {
131131
let data = ArtifactNotification { artifact: path, emit: artifact_type };
132-
let result = self.emit(EmitTyped::Artifact(data));
132+
let result = self.emit(&EmitTyped::Artifact(data));
133133
if let Err(e) = result {
134134
panic!("failed to print notification: {e:?}");
135135
}
@@ -155,7 +155,7 @@ impl Emitter for JsonEmitter {
155155
})
156156
.collect();
157157
let report = FutureIncompatReport { future_incompat_report: data };
158-
let result = self.emit(EmitTyped::FutureIncompat(report));
158+
let result = self.emit(&EmitTyped::FutureIncompat(report));
159159
if let Err(e) = result {
160160
panic!("failed to print future breakage report: {e:?}");
161161
}
@@ -164,7 +164,7 @@ impl Emitter for JsonEmitter {
164164
fn emit_unused_externs(&mut self, lint_level: rustc_lint_defs::Level, unused_externs: &[&str]) {
165165
let lint_level = lint_level.as_str();
166166
let data = UnusedExterns { lint_level, unused_extern_names: unused_externs };
167-
let result = self.emit(EmitTyped::UnusedExtern(data));
167+
let result = self.emit(&EmitTyped::UnusedExtern(data));
168168
if let Err(e) = result {
169169
panic!("failed to print unused externs: {e:?}");
170170
}

0 commit comments

Comments
 (0)