Merge pull request #270 from deg4uss3r/degausser/bump_cargo_0.54

Degausser/bump cargo 0.54
diff --git a/Cargo.lock b/Cargo.lock
index b6c63bf..5f1dc39 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,7 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+version = 3
+
 [[package]]
 name = "adler"
 version = "1.0.2"
@@ -79,19 +81,18 @@
 
 [[package]]
 name = "cargo"
-version = "0.52.0"
+version = "0.54.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "668794d3757557250a8b7bf7d0920ca60910d9635e76d008caed037ec25c39b3"
+checksum = "6cbd976a733418564685769d03cca35bf228ddfc2c8a5e6771ca0f48ce80ae2e"
 dependencies = [
  "anyhow",
  "atty",
  "bytesize",
  "cargo-platform",
+ "cargo-util",
  "clap",
- "core-foundation",
  "crates-io",
  "crossbeam-utils",
- "crypto-hash",
  "curl",
  "curl-sys",
  "env_logger",
@@ -113,14 +114,13 @@
  "libgit2-sys",
  "log",
  "memchr",
- "miow",
  "num_cpus",
  "opener",
  "openssl",
  "percent-encoding",
+ "rand",
  "rustc-workspace-hack",
  "rustfix",
- "same-file",
  "semver",
  "serde",
  "serde_ignored",
@@ -140,7 +140,7 @@
 
 [[package]]
 name = "cargo-outdated"
-version = "0.9.15"
+version = "0.9.16"
 dependencies = [
  "anyhow",
  "cargo",
@@ -167,6 +167,28 @@
 ]
 
 [[package]]
+name = "cargo-util"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0c5259672ff02c8c4d291fb52c9e6936d97dbfacea8d7011a0621aaaaab4c28"
+dependencies = [
+ "anyhow",
+ "core-foundation",
+ "crypto-hash",
+ "filetime",
+ "hex 0.4.3",
+ "jobserver",
+ "libc",
+ "log",
+ "miow",
+ "same-file",
+ "shell-escape",
+ "tempfile",
+ "walkdir",
+ "winapi",
+]
+
+[[package]]
 name = "cc"
 version = "1.0.67"
 source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index cabd4ed..c8f4433 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "cargo-outdated"
-version = "0.9.15"
+version = "0.9.16"
 authors = [
     "Kevin K. <kbknapp@gmail.com>",
     "Frederick Z. <frederick888@tsundere.moe>",
@@ -29,7 +29,7 @@
 
 [dependencies]
 anyhow = "1.0"
-cargo = "0.52.0"
+cargo = "0.54.0"
 docopt = "1.1.0"
 env_logger = "0.8.0"
 git2-curl = "0.14.0"
diff --git a/src/cargo_ops/elaborate_workspace.rs b/src/cargo_ops/elaborate_workspace.rs
index 11b4f67..1c833bb 100644
--- a/src/cargo_ops/elaborate_workspace.rs
+++ b/src/cargo_ops/elaborate_workspace.rs
@@ -2,12 +2,16 @@
 use std::cmp::Ordering;
 use std::collections::{BTreeSet, HashMap, VecDeque};
 use std::io::{self, Write};
+use std::rc::Rc;
 
 use anyhow::anyhow;
 use cargo::core::compiler::{CompileKind, RustcTargetData};
 use cargo::core::resolver::features::{ForceAllTargets, HasDevUnits};
+use cargo::core::resolver::CliFeatures;
+use cargo::core::FeatureValue;
 use cargo::core::{dependency::DepKind, Dependency, Package, PackageId, Workspace};
 use cargo::ops::{self, Packages};
+use cargo::util::interning::InternedString;
 use cargo::util::{CargoResult, Config};
 use serde::{Deserialize, Serialize};
 use tabwriter::TabWriter;
@@ -45,11 +49,15 @@
 }
 
 impl Ord for Metadata {
-    fn cmp(&self, other: &Self) -> Ordering { self.name.cmp(&other.name) }
+    fn cmp(&self, other: &Self) -> Ordering {
+        self.name.cmp(&other.name)
+    }
 }
 
 impl PartialOrd for Metadata {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp(other)) }
+    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+        Some(self.cmp(other))
+    }
 }
 
 impl<'ela> ElaborateWorkspace<'ela> {
@@ -58,14 +66,20 @@
         workspace: &'ela Workspace<'_>,
         options: &Options,
     ) -> CargoResult<ElaborateWorkspace<'ela>> {
-        use cargo::core::resolver::{features::RequestedFeatures, ResolveOpts};
+        // new in cargo 0.54.0
+        let flag_features: BTreeSet<FeatureValue> = options
+            .flag_features
+            .iter()
+            .map(|feature| FeatureValue::new(InternedString::from(feature)))
+            .collect();
         let specs = Packages::All.to_package_id_specs(workspace)?;
-        let features = RequestedFeatures::from_command_line(
-            &options.flag_features,
-            options.all_features(),
-            options.no_default_features(),
-        );
-        let opts = ResolveOpts::new(true, features);
+
+        let cli_features = CliFeatures {
+            features: Rc::new(flag_features),
+            all_features: options.all_features(),
+            uses_default_features: options.no_default_features(),
+        };
+
         //The CompileKind, this has no target since it's the temp workspace
         //targets are blank since we don't need to fully build for the targets to get the dependencies
         let compile_kind = CompileKind::from_requested_targets(workspace.config(), &[])?;
@@ -74,7 +88,7 @@
             &workspace,
             &target_data,
             &compile_kind,
-            &opts,
+            &cli_features,
             &specs,
             HasDevUnits::Yes,
             ForceAllTargets::Yes,
@@ -213,7 +227,7 @@
             // generate pkg_status
             let status = PkgStatus {
                 compat: Status::from_versions(pkg.version(), compat_pkg.map(PackageId::version)),
-                latest: Status::from_versions(pkg.version(), latest_pkg.map(PackageId::version)),
+                latest: Status::from_versions(&pkg.version(), latest_pkg.map(PackageId::version)),
             };
             debug!(
                 _config,
diff --git a/src/cargo_ops/pkg_status.rs b/src/cargo_ops/pkg_status.rs
index 0156bfb..4846f84 100644
--- a/src/cargo_ops/pkg_status.rs
+++ b/src/cargo_ops/pkg_status.rs
@@ -21,7 +21,9 @@
         }
     }
 
-    pub fn is_changed(&self) -> bool { !matches!(*self, Status::Unchanged) }
+    pub fn is_changed(&self) -> bool {
+        !matches!(*self, Status::Unchanged)
+    }
 }
 
 impl ::std::string::ToString for Status {
diff --git a/src/cargo_ops/temp_project.rs b/src/cargo_ops/temp_project.rs
index 5d831e7..3aaa4a7 100644
--- a/src/cargo_ops/temp_project.rs
+++ b/src/cargo_ops/temp_project.rs
@@ -6,10 +6,9 @@
 use std::path::{Path, PathBuf};
 use std::rc::Rc;
 
-use anyhow::anyhow;
+use anyhow::{anyhow, Context};
 use cargo::core::{Dependency, PackageId, Summary, Verbosity, Workspace};
 use cargo::ops::{update_lockfile, UpdateOptions};
-use cargo::util::errors::CargoResultExt;
 use cargo::util::{CargoResult, Config};
 use semver::{Identifier, Version, VersionReq};
 use tempfile::{Builder, TempDir};
@@ -170,7 +169,7 @@
     ) -> CargoResult<Config> {
         let shell = ::cargo::core::Shell::new();
         let cwd = env::current_dir()
-            .chain_err(|| "Cargo couldn't get the current directory of the process")?;
+            .with_context(|| "Cargo couldn't get the current directory of the process")?;
 
         let homedir = ::cargo::util::homedir(&cwd).ok_or_else(|| {
             anyhow!(
diff --git a/src/main.rs b/src/main.rs
index 5aa5983..d1b642d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,6 @@
 mod cargo_ops;
 use crate::cargo_ops::{ElaborateWorkspace, TempProject};
 
-use cargo::core::maybe_allow_nightly_features;
 use cargo::core::shell::Verbosity;
 use cargo::core::Workspace;
 use cargo::ops::needs_custom_http_transport;
@@ -63,15 +62,21 @@
 }
 
 impl Options {
-    fn all_features(&self) -> bool { self.flag_features.is_empty() }
+    fn all_features(&self) -> bool {
+        self.flag_features.is_empty()
+    }
 
     fn no_default_features(&self) -> bool {
         !(self.flag_features.is_empty() || self.flag_features.contains(&"default".to_owned()))
     }
 
-    fn locked(&self) -> bool { false }
+    fn locked(&self) -> bool {
+        false
+    }
 
-    fn frozen(&self) -> bool { false }
+    fn frozen(&self) -> bool {
+        false
+    }
 }
 
 fn main() {
@@ -147,6 +152,9 @@
     // if it is, set it in the configure options
     let cargo_home_path = std::env::var_os("CARGO_HOME").map(std::path::PathBuf::from);
 
+    // enabling nightly features
+    config.nightly_features_allowed = true;
+
     config.configure(
         options.flag_verbose,
         options.flag_quiet,
@@ -160,9 +168,6 @@
     )?;
     debug!(config, format!("options: {:?}", options));
 
-    // Needed to allow nightly features
-    maybe_allow_nightly_features();
-
     verbose!(config, "Parsing...", "current workspace");
     // the Cargo.toml that we are actually working on
     let mut manifest_abspath: std::path::PathBuf;