about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-01-03 17:03:10 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-01-08 15:45:29 +1100
commitbd4e623485f383b478fae662a767a3129bb4b989 (patch)
treefe4207cae336d51d0c29fd430b1d402d1de8339e /src
parent589591efde6c54baa8b7932ec3be6f45dc9d781f (diff)
Use chaining for `DiagnosticBuilder` construction and `emit`.
To avoid the use of a mutable local variable, and because it reads more
nicely.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/core.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 359d5ec485e..40ea4346f93 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -495,16 +495,16 @@ impl<'tcx> Visitor<'tcx> for EmitIgnoredResolutionErrors<'tcx> {
                     .intersperse("::")
                     .collect::<String>()
             );
-            let mut err = rustc_errors::struct_span_err!(
+            rustc_errors::struct_span_err!(
                 self.tcx.dcx(),
                 path.span,
                 E0433,
                 "failed to resolve: {label}",
-            );
-            err.span_label(path.span, label);
-            err.note("this error was originally ignored because you are running `rustdoc`");
-            err.note("try running again with `rustc` or `cargo check` and you may get a more detailed error");
-            err.emit();
+            )
+            .span_label_mv(path.span, label)
+            .note_mv("this error was originally ignored because you are running `rustdoc`")
+            .note_mv("try running again with `rustc` or `cargo check` and you may get a more detailed error")
+            .emit();
         }
         // We could have an outer resolution that succeeded,
         // but with generic parameters that failed.