about summary refs log tree commit diff
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
commite6570dccccd85f5bfc8497bbd4db615f1d2fdbd2 (patch)
tree0ecb84f9e63f63331f86a5661e557d66408ef2a6
parent0cfbc47b9a32735659f8347872c571bdfeba8424 (diff)
downloadrust-e6570dccccd85f5bfc8497bbd4db615f1d2fdbd2.tar.gz
rust-e6570dccccd85f5bfc8497bbd4db615f1d2fdbd2.zip
Use chaining for `DiagnosticBuilder` construction and `emit`.
To avoid the use of a mutable local variable, and because it reads more
nicely.
-rw-r--r--src/driver/jit.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/driver/jit.rs b/src/driver/jit.rs
index a8d8fb189e2..50d9f287e74 100644
--- a/src/driver/jit.rs
+++ b/src/driver/jit.rs
@@ -321,9 +321,10 @@ fn dep_symbol_lookup_fn(
             Linkage::NotLinked | Linkage::IncludedFromDylib => {}
             Linkage::Static => {
                 let name = crate_info.crate_name[&cnum];
-                let mut err = sess.dcx().struct_err(format!("Can't load static lib {}", name));
-                err.note("rustc_codegen_cranelift can only load dylibs in JIT mode.");
-                err.emit();
+                sess.dcx()
+                    .struct_err(format!("Can't load static lib {}", name))
+                    .note("rustc_codegen_cranelift can only load dylibs in JIT mode.")
+                    .emit();
             }
             Linkage::Dynamic => {
                 dylib_paths.push(src.dylib.as_ref().unwrap().0.clone());