diff --git a/Cargo.lock b/Cargo.lock index 2dcac48..90ee366 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -343,7 +343,7 @@ dependencies = [ [[package]] name = "cargo-outdated" -version = "0.15.0" +version = "0.16.0" dependencies = [ "anyhow", "cargo", @@ -351,6 +351,7 @@ dependencies = [ "env_logger", "git2-curl", "pretty_assertions", + "rustc-hash", "semver", "serde", "serde_json", @@ -2769,6 +2770,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "rustc-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" + [[package]] name = "rustfix" version = "0.8.7" diff --git a/Cargo.toml b/Cargo.toml index d9d1565..133bf24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ tempfile = "3.6" toml = "0.8.6" clap = { version = "4.1.4", features = ["derive"] } strum = { version = "0.26.3", features = ["derive"] } +rustc-hash = "2.0" [features] debug = [] diff --git a/src/cargo_ops/elaborate_workspace.rs b/src/cargo_ops/elaborate_workspace.rs index 9144fbd..2ddd283 100644 --- a/src/cargo_ops/elaborate_workspace.rs +++ b/src/cargo_ops/elaborate_workspace.rs @@ -20,6 +20,7 @@ use cargo::{ ops::{self, Packages}, util::{context::GlobalContext, interning::InternedString, CargoResult}, }; +use rustc_hash::FxHashMap; use serde::{Deserialize, Serialize}; use tabwriter::TabWriter; @@ -31,10 +32,10 @@ use super::{pkg_status::*, Options}; /// the update status of packages pub struct ElaborateWorkspace<'ela> { pub workspace: &'ela Workspace<'ela>, - pub pkgs: HashMap, - pub pkg_deps: HashMap>, + pub pkgs: FxHashMap, + pub pkg_deps: FxHashMap>, /// Map of package status - pub pkg_status: RefCell, PkgStatus>>, + pub pkg_status: RefCell, PkgStatus>>, /// Whether using workspace mode pub workspace_mode: bool, } @@ -103,13 +104,13 @@ impl<'ela> ElaborateWorkspace<'ela> { let resolve = ws_resolve .workspace_resolve .expect("Error getting workspace resolved"); - let mut pkgs = HashMap::new(); - let mut pkg_deps = HashMap::new(); + let mut pkgs = FxHashMap::default(); + let mut pkg_deps = FxHashMap::default(); for pkg in packages.get_many(packages.package_ids())? { let pkg_id = pkg.package_id(); pkgs.insert(pkg_id, pkg.clone()); let deps = pkg.dependencies(); - let mut dep_map = HashMap::new(); + let mut dep_map = FxHashMap::default(); for dep_id in resolve.deps(pkg_id) { for d in deps { if d.matches_id(dep_id.0) { @@ -125,7 +126,7 @@ impl<'ela> ElaborateWorkspace<'ela> { workspace, pkgs, pkg_deps, - pkg_status: RefCell::new(HashMap::new()), + pkg_status: RefCell::new(FxHashMap::default()), workspace_mode: options.workspace || workspace.current().is_err(), }) }