about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/diagnostic_builder.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-01-03 16:00:29 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-01-08 15:43:07 +1100
commit589591efde6c54baa8b7932ec3be6f45dc9d781f (patch)
tree111b41a6211a9101546d182d294f552734c092c6 /compiler/rustc_errors/src/diagnostic_builder.rs
parentb1b9278851a9512a0c934c12f9c1800169c336f7 (diff)
downloadrust-589591efde6c54baa8b7932ec3be6f45dc9d781f.tar.gz
rust-589591efde6c54baa8b7932ec3be6f45dc9d781f.zip
Use chaining in `DiagnosticBuilder` construction.
To avoid the use of a mutable local variable, and because it reads more
nicely.
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic_builder.rs')
-rw-r--r--compiler/rustc_errors/src/diagnostic_builder.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs
index e41acd6447b..b3f8a6c2440 100644
--- a/compiler/rustc_errors/src/diagnostic_builder.rs
+++ b/compiler/rustc_errors/src/diagnostic_builder.rs
@@ -30,9 +30,7 @@ where
     G: EmissionGuarantee,
 {
     fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
-        let mut diag = self.node.into_diagnostic(dcx, level);
-        diag.span(self.span);
-        diag
+        self.node.into_diagnostic(dcx, level).span_mv(self.span)
     }
 }