diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-03 16:00:29 +1100 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-08 15:43:07 +1100 | 
| commit | 589591efde6c54baa8b7932ec3be6f45dc9d781f (patch) | |
| tree | 111b41a6211a9101546d182d294f552734c092c6 /compiler/rustc_hir_analysis/src | |
| parent | b1b9278851a9512a0c934c12f9c1800169c336f7 (diff) | |
| download | rust-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.rs | 6 | 
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) { | 
