about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-04-11 17:29:51 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-04-12 08:02:32 +1000
commitc9b0635679fc5bb4fd157e1eaad8e7f21705d68a (patch)
tree157d4ea22c313835919994be84752f709bc4af72
parent955ba37aa597843abe5171fd80079f4f456785fb (diff)
downloadrust-c9b0635679fc5bb4fd157e1eaad8e7f21705d68a.tar.gz
rust-c9b0635679fc5bb4fd157e1eaad8e7f21705d68a.zip
Inline and remove `DescriptionCtx::add_to`.
It has a single callsite.
-rw-r--r--compiler/rustc_infer/src/errors/note_and_explain.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_infer/src/errors/note_and_explain.rs b/compiler/rustc_infer/src/errors/note_and_explain.rs
index 744fb27635a..c4f2cf62ddd 100644
--- a/compiler/rustc_infer/src/errors/note_and_explain.rs
+++ b/compiler/rustc_infer/src/errors/note_and_explain.rs
@@ -108,11 +108,6 @@ impl<'a> DescriptionCtx<'a> {
         }
         Some(me)
     }
-
-    fn add_to(self, diag: &mut rustc_errors::Diagnostic) {
-        diag.set_arg("desc_kind", self.kind);
-        diag.set_arg("desc_arg", self.arg);
-    }
 }
 
 pub enum PrefixKind {
@@ -196,10 +191,11 @@ impl AddToDiagnostic for RegionExplanation<'_> {
     {
         diag.set_arg("pref_kind", self.prefix);
         diag.set_arg("suff_kind", self.suffix);
-        let desc_span = self.desc.span;
-        self.desc.add_to(diag);
+        diag.set_arg("desc_kind", self.desc.kind);
+        diag.set_arg("desc_arg", self.desc.arg);
+
         let msg = f(diag, fluent::infer_region_explanation.into());
-        if let Some(span) = desc_span {
+        if let Some(span) = self.desc.span {
             diag.span_note(span, msg);
         } else {
             diag.note(msg);