Skip to content

Commit e6570dc

Browse files
committed
Use chaining for DiagnosticBuilder construction and emit.
To avoid the use of a mutable local variable, and because it reads more nicely.
1 parent 0cfbc47 commit e6570dc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/driver/jit.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,10 @@ fn dep_symbol_lookup_fn(
321321
Linkage::NotLinked | Linkage::IncludedFromDylib => {}
322322
Linkage::Static => {
323323
let name = crate_info.crate_name[&cnum];
324-
let mut err = sess.dcx().struct_err(format!("Can't load static lib {}", name));
325-
err.note("rustc_codegen_cranelift can only load dylibs in JIT mode.");
326-
err.emit();
324+
sess.dcx()
325+
.struct_err(format!("Can't load static lib {}", name))
326+
.note("rustc_codegen_cranelift can only load dylibs in JIT mode.")
327+
.emit();
327328
}
328329
Linkage::Dynamic => {
329330
dylib_paths.push(src.dylib.as_ref().unwrap().0.clone());

0 commit comments

Comments
 (0)