Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
Update cargo_metadata to 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasdenH committed Jun 26, 2019
1 parent f4779be commit cd91478
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ documentation = "https://rustwasm.github.io/wasm-pack/"

[dependencies]
atty = "0.2.11"
cargo_metadata = "0.6.0"
cargo_metadata = "0.8.0"
console = "0.6.1"
dialoguer = "0.3.0"
curl = "0.4.13"
Expand Down
31 changes: 12 additions & 19 deletions src/manifest/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//! Reading and writing Cargo.toml and package.json manifests.
#![allow(clippy::new_ret_no_self, clippy::needless_pass_by_value, clippy::redundant_closure)]
#![allow(
clippy::new_ret_no_self,
clippy::needless_pass_by_value,
clippy::redundant_closure
)]

mod npm;

Expand Down Expand Up @@ -350,8 +354,9 @@ impl CrateData {
)
}

let data =
cargo_metadata::metadata(Some(&manifest_path)).map_err(error_chain_to_failure)?;
let data = cargo_metadata::MetadataCommand::new()
.manifest_path(&manifest_path)
.exec()?;

let manifest_and_keys = CrateData::parse_crate_data(&manifest_path)?;
CrateData::warn_for_unused_keys(&manifest_and_keys);
Expand All @@ -369,18 +374,6 @@ impl CrateData {
current_idx,
out_name,
});

fn error_chain_to_failure(err: cargo_metadata::Error) -> Error {
let errors = err.iter().collect::<Vec<_>>();
let mut err: Error = match errors.last() {
Some(e) => format_err!("{}", e),
None => return format_err!("{}", err),
};
for e in errors[..errors.len() - 1].iter().rev() {
err = err.context(e.to_string()).into();
}
err
}
}

/// Read the `manifest_path` file and deserializes it using the toml Deserializer.
Expand Down Expand Up @@ -596,7 +589,7 @@ impl CrateData {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
version: pkg.version.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
Expand Down Expand Up @@ -629,7 +622,7 @@ impl CrateData {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
version: pkg.version.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
Expand Down Expand Up @@ -658,7 +651,7 @@ impl CrateData {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
version: pkg.version.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
Expand Down Expand Up @@ -692,7 +685,7 @@ impl CrateData {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
version: pkg.version.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
Expand Down

0 comments on commit cd91478

Please sign in to comment.