diff --git a/src/cargo/core/compiler/context/mod.rs b/src/cargo/core/compiler/context/mod.rs index 6adccbd4cd4..8df9d799ccd 100644 --- a/src/cargo/core/compiler/context/mod.rs +++ b/src/cargo/core/compiler/context/mod.rs @@ -504,14 +504,12 @@ impl<'a, 'cfg> Context<'a, 'cfg> { // Drain the client fully for i in 0..tokens { - while let Err(e) = client.acquire_raw() { - anyhow::bail!( - "failed to fully drain {}/{} token from jobserver at startup: {:?}", - i, - tokens, - e, - ); - } + client.acquire_raw().chain_err(|| { + format!( + "failed to fully drain {}/{} token from jobserver at startup", + i, tokens, + ) + })?; } Ok(client)