about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-01 19:18:25 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-03 09:02:50 +1100
commit8ba25d0989f8d96cbcb4365fc61b469575e22d63 (patch)
treeb6bcf302daeef503c4688dd61c5a35eeae469e3f /compiler/rustc_errors/src
parenta9a2e1565abbeae741d6d715224194caf500099b (diff)
downloadrust-8ba25d0989f8d96cbcb4365fc61b469575e22d63.tar.gz
rust-8ba25d0989f8d96cbcb4365fc61b469575e22d63.zip
`SilentEmitter::fatal_note` doesn't need to be optional.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/emitter.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 9f76c1dd248..4be5ed923e5 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -558,7 +558,7 @@ impl Emitter for HumanEmitter {
 /// failures of rustc, as witnessed e.g. in issue #89358.
 pub struct SilentEmitter {
     pub fatal_dcx: DiagCtxt,
-    pub fatal_note: Option<String>,
+    pub fatal_note: String,
 }
 
 impl Translate for SilentEmitter {
@@ -576,13 +576,11 @@ impl Emitter for SilentEmitter {
         None
     }
 
-    fn emit_diagnostic(&mut self, d: &Diagnostic) {
-        if d.level == Level::Fatal {
-            let mut d = d.clone();
-            if let Some(ref note) = self.fatal_note {
-                d.note(note.clone());
-            }
-            self.fatal_dcx.emit_diagnostic(d);
+    fn emit_diagnostic(&mut self, diag: &Diagnostic) {
+        if diag.level == Level::Fatal {
+            let mut diag = diag.clone();
+            diag.note(self.fatal_note.clone());
+            self.fatal_dcx.emit_diagnostic(diag);
         }
     }
 }