Skip to content

Commit ac6e9ee

Browse files
committed
Update cargo_metadata to v0.10.0
1 parent 862c82a commit ac6e9ee

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2626

2727
- Changed help output to more closely reflect the help command of `cargo` subcommands
2828
- Removed `walkdir` dependency by using expected path to tool executable
29+
- Updated `cargo_metadata 0.9 -> 0.10`
2930

3031
## [v0.2.0] - 2020-04-11
3132

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repository = "https://github.com/rust-embedded/cargo-binutils/"
1212
version = "0.2.0"
1313

1414
[dependencies]
15-
cargo_metadata = "0.9.1"
15+
cargo_metadata = "0.10.0"
1616
clap = "2.33.0"
1717
failure = "0.1.7"
1818
regex = "1.3.6"

src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![deny(warnings)]
22

3-
use std::io::{self, Write};
3+
use std::io::{self, BufReader, Write};
44
use std::path::{Component, Path};
55
use std::process::{Command, Stdio};
66
use std::{env, str};
77

8-
use cargo_metadata::{parse_messages, Artifact, CargoOpt, Message, Metadata, MetadataCommand};
8+
use cargo_metadata::{Artifact, CargoOpt, Message, Metadata, MetadataCommand};
99
use clap::{App, AppSettings, Arg};
1010
use failure::bail;
1111
use rustc_cfg::Cfg;
@@ -241,10 +241,10 @@ fn determine_artifact(
241241
}
242242

243243
let mut child = cargo.spawn()?;
244-
let stdout = child.stdout.take().expect("Pipe to cargo process failed");
244+
let stdout = BufReader::new(child.stdout.take().expect("Pipe to cargo process failed"));
245245

246246
// Note: We call `collect` to ensure we don't block stdout which could prevent the process from exiting
247-
let messages = parse_messages(stdout).collect::<Vec<_>>();
247+
let messages = Message::parse_stream(stdout).collect::<Vec<_>>();
248248

249249
let status = child.wait()?;
250250
if !status.success() {
@@ -255,7 +255,9 @@ fn determine_artifact(
255255
for message in messages {
256256
match message? {
257257
Message::CompilerArtifact(artifact) => {
258-
if metadata.workspace_members.contains(&artifact.package_id) && build_type.matches(&artifact) {
258+
if metadata.workspace_members.contains(&artifact.package_id)
259+
&& build_type.matches(&artifact)
260+
{
259261
if wanted_artifact.is_some() {
260262
bail!("Can only have one matching artifact but found several");
261263
}
@@ -452,7 +454,7 @@ To see all the flags the proxied tool accepts run `cargo-{} -- -help`.{}",
452454

453455
match tool {
454456
// Tools that don't need a build
455-
Tool::Ar | Tool::Lld | Tool::Profdata => {},
457+
Tool::Ar | Tool::Lld | Tool::Profdata => {}
456458
// for some tools we change the CWD (current working directory) and
457459
// make the artifact path relative. This makes the path that the
458460
// tool will print easier to read. e.g. `libfoo.rlib` instead of

0 commit comments

Comments
 (0)