about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
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_hir_analysis/src
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_hir_analysis/src')
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index c53ff565550..4bac124b58b 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -1921,10 +1921,8 @@ fn check_mod_type_wf(tcx: TyCtxt<'_>, module: LocalModDefId) -> Result<(), Error
 }
 
 fn error_392(tcx: TyCtxt<'_>, span: Span, param_name: Symbol) -> DiagnosticBuilder<'_> {
-    let mut err =
-        struct_span_err!(tcx.dcx(), span, E0392, "parameter `{param_name}` is never used");
-    err.span_label(span, "unused parameter");
-    err
+    struct_span_err!(tcx.dcx(), span, E0392, "parameter `{param_name}` is never used")
+        .span_label_mv(span, "unused parameter")
 }
 
 pub fn provide(providers: &mut Providers) {