Skip to content

Commit

Permalink
refactor: remove mut from emit_warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
arlosi committed Sep 13, 2024
1 parent 30d0d5d commit 36cbb68
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cargo/core/compiler/job_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,32 +963,32 @@ impl<'gctx> DrainState<'gctx> {
}

fn emit_warnings(
&mut self,
&self,
msg: Option<&str>,
unit: &Unit,
build_runner: &mut BuildRunner<'_, '_>,
build_runner: &BuildRunner<'_, '_>,
) -> CargoResult<()> {
let outputs = build_runner.build_script_outputs.lock().unwrap();
let Some(metadata) = build_runner.find_build_script_metadata(unit) else {
return Ok(());
};
let bcx = &mut build_runner.bcx;
let gctx = build_runner.bcx.gctx;
if let Some(output) = outputs.get(metadata) {
if !output.warnings.is_empty() {
if let Some(msg) = msg {
writeln!(bcx.gctx.shell().err(), "{}\n", msg)?;
writeln!(gctx.shell().err(), "{}\n", msg)?;
}

for warning in output.warnings.iter() {
let warning_with_package =
format!("{}@{}: {}", unit.pkg.name(), unit.pkg.version(), warning);

bcx.gctx.shell().warn(warning_with_package)?;
gctx.shell().warn(warning_with_package)?;
}

if msg.is_some() {
// Output an empty line.
writeln!(bcx.gctx.shell().err())?;
writeln!(gctx.shell().err())?;
}
}
}
Expand Down

0 comments on commit 36cbb68

Please sign in to comment.