diff --git a/Cargo.lock b/Cargo.lock index 4bd058b0a..08554f181 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2333,6 +2333,7 @@ dependencies = [ "pyproject-toml", "requirements-txt", "reqwest", + "rustc-hash", "tempfile", "textwrap", "thiserror", diff --git a/crates/puffin-cli/Cargo.toml b/crates/puffin-cli/Cargo.toml index 76eb26cd2..75584580f 100644 --- a/crates/puffin-cli/Cargo.toml +++ b/crates/puffin-cli/Cargo.toml @@ -51,6 +51,7 @@ itertools = { workspace = true } miette = { workspace = true, features = ["fancy"] } pubgrub = { workspace = true } pyproject-toml = { workspace = true } +rustc-hash = { workspace = true } tempfile = { workspace = true } textwrap = { workspace = true } thiserror = { workspace = true } diff --git a/crates/puffin-cli/src/requirements.rs b/crates/puffin-cli/src/requirements.rs index cddbe19c3..e04879587 100644 --- a/crates/puffin-cli/src/requirements.rs +++ b/crates/puffin-cli/src/requirements.rs @@ -1,11 +1,11 @@ //! A standard interface for working with heterogeneous sources of requirements. -use std::collections::HashSet; use std::path::PathBuf; use std::str::FromStr; use anyhow::{Context, Result}; use fs_err as fs; +use rustc_hash::FxHashSet; use pep508_rs::Requirement; use puffin_normalize::{ExtraName, PackageName}; @@ -65,7 +65,7 @@ pub(crate) struct RequirementsSpecification { /// The constraints for the project. pub(crate) constraints: Vec, /// The extras used to collect requirements. - pub(crate) extras: HashSet, + pub(crate) extras: FxHashSet, } impl RequirementsSpecification { @@ -82,7 +82,7 @@ impl RequirementsSpecification { project: None, requirements: vec![requirement], constraints: vec![], - extras: HashSet::new(), + extras: FxHashSet::default(), } } RequirementsSource::RequirementsTxt(path) => { @@ -95,14 +95,14 @@ impl RequirementsSpecification { .map(|entry| entry.requirement) .collect(), constraints: requirements_txt.constraints.into_iter().collect(), - extras: HashSet::new(), + extras: FxHashSet::default(), } } RequirementsSource::PyprojectToml(path) => { let contents = fs::read_to_string(path)?; let pyproject_toml = toml::from_str::(&contents) .with_context(|| format!("Failed to read `{}`", path.display()))?; - let mut used_extras = HashSet::new(); + let mut used_extras = FxHashSet::default(); let mut requirements = Vec::new(); let mut project_name = None; if let Some(project) = pyproject_toml.project {