Deduplicate code in proc-macro-srv

This commit is contained in:
Lukas Wirth 2025-06-05 07:25:14 +02:00
parent 2dc5aa885a
commit 02a788bfaa
6 changed files with 160 additions and 297 deletions

View file

@ -431,12 +431,6 @@ impl CargoWorkspace {
.ok_or(cargo_metadata::Error::NoJson)?;
Ok((cargo_metadata::MetadataCommand::parse(stdout)?, None))
})()
.map(|(metadata, error)| {
(
metadata,
error.map(|e| e.context(format!("Failed to run `{:?}`", meta.cargo_command()))),
)
})
.with_context(|| format!("Failed to run `{:?}`", meta.cargo_command()))
}