From 9e5235dce7539af1055ee4cf83a8a6733f4c5b1f Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 20 Jan 2020 10:27:25 +0100 Subject: [PATCH] Upgrade cargo from 0.40 to 0.41 Requires a new dependency on cargo-platform --- Cargo.lock | 38 ++++++++++++++++++-------------------- cargo-geiger/Cargo.toml | 3 ++- cargo-geiger/src/cli.rs | 13 +++++++++---- cargo-geiger/src/main.rs | 7 ++++++- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2decbc45..cbc05276 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -103,19 +103,20 @@ dependencies = [ [[package]] name = "cargo" -version = "0.40.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-platform 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crates-io 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-hash 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", "curl-sys 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -166,7 +167,8 @@ version = "0.9.0" dependencies = [ "assert_cmd 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "better-panic 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo 0.40.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-platform 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -179,6 +181,14 @@ dependencies = [ "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cargo-platform" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cc" version = "1.0.47" @@ -275,7 +285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "crates-io" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -372,18 +382,6 @@ name = "encode_unicode" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "env_logger" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "env_logger" version = "0.7.1" @@ -1359,7 +1357,8 @@ dependencies = [ "checksum bstr 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8d6c2c5b58ab920a4f5aeaaca34b4488074e8cc7596af94e6f8c6ff247c60245" "checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cargo 0.40.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03504435a39de1303decb9c9a7416e875f16d4b94769d4d0dd5e1bfb21229640" +"checksum cargo 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2737475f76ce9681e230a4e5cb2476fb133875f28fd84a834a6b5aefd83d3741" +"checksum cargo-platform 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e78cce7683c0998d7a11405dcd13e31b23a930d4b5bba9e4245bdfba6bcd462c" "checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" @@ -1370,7 +1369,7 @@ dependencies = [ "checksum console 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f5d540c2d34ac9dd0deb5f3b5f54c36c79efa78f6b3ad19106a554d07a7b5d9f" "checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" -"checksum crates-io 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9dc57b7035c84bcaaa14d89221491b624a32977c230ce6bb77ae191e880c48e1" +"checksum crates-io 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54a5db4b026e2d3bad49a9775b01722035ebc6976b95ec556716852d640f3ad5" "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" "checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" @@ -1381,7 +1380,6 @@ dependencies = [ "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" -"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" "checksum escargot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ceb9adbf9874d5d028b5e4c5739d22b71988252b25c9c98fe7cf9738bee84597" "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" diff --git a/cargo-geiger/Cargo.toml b/cargo-geiger/Cargo.toml index c7850b01..a5a4804d 100644 --- a/cargo-geiger/Cargo.toml +++ b/cargo-geiger/Cargo.toml @@ -14,7 +14,8 @@ version = "0.9.0" maintenance = { status = "experimental" } [dependencies] -cargo = "0.40.0" +cargo = "0.41.0" +cargo-platform = "0.1.0" colored = "1.9.0" console = "0.9.1" env_logger = "0.7.1" diff --git a/cargo-geiger/src/cli.rs b/cargo-geiger/src/cli.rs index 1a3b7a99..044c3d89 100644 --- a/cargo-geiger/src/cli.rs +++ b/cargo-geiger/src/cli.rs @@ -15,6 +15,7 @@ use crate::format::Pattern; use crate::Args; use cargo::core::compiler::CompileMode; use cargo::core::compiler::Executor; +use cargo::core::compiler::ProfileKind; use cargo::core::compiler::Unit; use cargo::core::dependency::Kind; use cargo::core::manifest::TargetKind; @@ -29,9 +30,10 @@ use cargo::ops::CleanOptions; use cargo::ops::CompileOptions; use cargo::util::paths; use cargo::util::ProcessBuilder; -use cargo::util::{self, important_paths, CargoResult, Cfg}; +use cargo::util::{self, important_paths, CargoResult}; use cargo::CliResult; use cargo::Config; +use cargo_platform::Cfg; use colored::Colorize; use geiger::find_unsafe_in_file; use geiger::Count; @@ -106,7 +108,7 @@ pub struct Graph { /// TODO: Write proper documentation for this. /// This function seems to be looking up the active flags for conditional -/// compilation (cargo::util::Cfg instances). +/// compilation (cargo_platform::Cfg instances). pub fn get_cfgs( config: &Config, target: &Option, @@ -124,7 +126,9 @@ pub fn get_cfgs( let output = str::from_utf8(&output.stdout).unwrap(); let lines = output.lines(); Ok(Some( - lines.map(Cfg::from_str).collect::>>()?, + lines + .map(|s| Cfg::from_str(s).map_err(|e| e.into())) + .collect::>>()?, )) } @@ -938,7 +942,8 @@ fn resolve_rs_file_deps( config: &config, spec: vec![], target: None, - release: false, + profile_specified: false, + profile_kind: ProfileKind::Release, doc: false, }; ops::clean(ws, &clean_opt) diff --git a/cargo-geiger/src/main.rs b/cargo-geiger/src/main.rs index fa9663a7..fbac6f98 100644 --- a/cargo-geiger/src/main.rs +++ b/cargo-geiger/src/main.rs @@ -242,7 +242,12 @@ fn real_main(args: &Args, config: &mut Config) -> CliResult { let target = if args.all_targets { None } else { - Some(args.target.as_ref().unwrap_or(&config_host).as_str()) + Some( + args.target + .as_ref() + .map(|s| s.as_str()) + .unwrap_or(&config_host), + ) }; let format = Pattern::try_build(&args.format).map_err(|e| {