mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
refactor: use Cow on artifact notification
`artifact` field is an (absolute) path to emitted artifact like /home/projects/foo/target/debug/deps/libbar-73d672db2af2c9a8.rmeta It is worth not copying them.
This commit is contained in:
parent
cdba1c7bee
commit
d6b740f6f3
@ -1852,11 +1852,12 @@ fn on_stderr_line_inner(
|
||||
// Look for a matching directive and inform Cargo internally that a
|
||||
// metadata file has been produced.
|
||||
#[derive(serde::Deserialize)]
|
||||
struct ArtifactNotification {
|
||||
artifact: String,
|
||||
struct ArtifactNotification<'a> {
|
||||
#[serde(borrow)]
|
||||
artifact: Cow<'a, str>,
|
||||
}
|
||||
|
||||
if let Ok(artifact) = serde_json::from_str::<ArtifactNotification>(compiler_message.get()) {
|
||||
if let Ok(artifact) = serde_json::from_str::<ArtifactNotification<'_>>(compiler_message.get()) {
|
||||
trace!("found directive from rustc: `{}`", artifact.artifact);
|
||||
if artifact.artifact.ends_with(".rmeta") {
|
||||
debug!("looks like metadata finished early!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user