mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Update Rust crate rustc-hash to v2 (#4461)
This commit is contained in:
parent
8a0a3b47db
commit
3251690327
9 changed files with 47 additions and 54 deletions
|
@ -1,6 +1,4 @@
|
|||
use std::hash::BuildHasherDefault;
|
||||
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||
|
||||
use pypi_types::Requirement;
|
||||
use uv_normalize::PackageName;
|
||||
|
@ -13,7 +11,7 @@ impl Constraints {
|
|||
/// Create a new set of constraints from a set of requirements.
|
||||
pub fn from_requirements(requirements: Vec<Requirement>) -> Self {
|
||||
let mut constraints: FxHashMap<PackageName, Vec<Requirement>> =
|
||||
FxHashMap::with_capacity_and_hasher(requirements.len(), BuildHasherDefault::default());
|
||||
FxHashMap::with_capacity_and_hasher(requirements.len(), FxBuildHasher);
|
||||
for requirement in requirements {
|
||||
constraints
|
||||
.entry(requirement.name.clone())
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use std::hash::BuildHasherDefault;
|
||||
|
||||
use either::Either;
|
||||
use pypi_types::Requirement;
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||
|
||||
use pypi_types::Requirement;
|
||||
use uv_normalize::PackageName;
|
||||
|
||||
/// A set of overrides for a set of requirements.
|
||||
|
@ -14,7 +12,7 @@ impl Overrides {
|
|||
/// Create a new set of overrides from a set of requirements.
|
||||
pub fn from_requirements(requirements: Vec<Requirement>) -> Self {
|
||||
let mut overrides: FxHashMap<PackageName, Vec<Requirement>> =
|
||||
FxHashMap::with_capacity_and_hasher(requirements.len(), BuildHasherDefault::default());
|
||||
FxHashMap::with_capacity_and_hasher(requirements.len(), FxBuildHasher);
|
||||
for requirement in requirements {
|
||||
overrides
|
||||
.entry(requirement.name.clone())
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use std::collections::hash_map::Entry;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||
use tracing::debug;
|
||||
|
||||
use distribution_filename::WheelFilename;
|
||||
|
@ -71,10 +70,7 @@ impl<'a> Planner<'a> {
|
|||
let mut remote = vec![];
|
||||
let mut reinstalls = vec![];
|
||||
let mut extraneous = vec![];
|
||||
let mut seen = FxHashMap::with_capacity_and_hasher(
|
||||
self.requirements.len(),
|
||||
BuildHasherDefault::default(),
|
||||
);
|
||||
let mut seen = FxHashMap::with_capacity_and_hasher(self.requirements.len(), FxBuildHasher);
|
||||
|
||||
for requirement in self.requirements {
|
||||
// Filter out incompatible requirements.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::collections::BTreeSet;
|
||||
use std::iter::Flatten;
|
||||
use std::path::PathBuf;
|
||||
use std::{collections::BTreeSet, hash::BuildHasherDefault};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use fs_err as fs;
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
|
||||
use url::Url;
|
||||
|
||||
use distribution_types::{
|
||||
|
@ -257,8 +257,7 @@ impl SitePackages {
|
|||
constraints: &[Requirement],
|
||||
) -> Result<SatisfiesResult> {
|
||||
let mut stack = Vec::with_capacity(requirements.len());
|
||||
let mut seen =
|
||||
FxHashSet::with_capacity_and_hasher(requirements.len(), BuildHasherDefault::default());
|
||||
let mut seen = FxHashSet::with_capacity_and_hasher(requirements.len(), FxBuildHasher);
|
||||
|
||||
// Add the direct requirements to the queue.
|
||||
for entry in requirements {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use std::collections::BTreeSet;
|
||||
use std::hash::BuildHasherDefault;
|
||||
|
||||
use owo_colors::OwoColorize;
|
||||
use petgraph::visit::EdgeRef;
|
||||
use petgraph::Direction;
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||
|
||||
use distribution_types::{Name, SourceAnnotations};
|
||||
use uv_normalize::PackageName;
|
||||
|
@ -93,7 +92,7 @@ impl std::fmt::Display for DisplayResolutionGraph<'_> {
|
|||
);
|
||||
let mut inverse = FxHashMap::with_capacity_and_hasher(
|
||||
self.resolution.petgraph.node_count(),
|
||||
BuildHasherDefault::default(),
|
||||
FxBuildHasher,
|
||||
);
|
||||
|
||||
// Re-add the nodes to the reduced graph.
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use std::hash::BuildHasherDefault;
|
||||
|
||||
use indexmap::IndexSet;
|
||||
use petgraph::{
|
||||
graph::{Graph, NodeIndex},
|
||||
Directed,
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||
|
||||
use distribution_types::{
|
||||
Dist, DistributionMetadata, Name, ResolutionDiagnostic, VersionId, VersionOrUrlRef,
|
||||
|
@ -56,10 +55,8 @@ impl ResolutionGraph {
|
|||
) -> Result<Self, ResolveError> {
|
||||
let mut petgraph: Graph<AnnotatedDist, Option<MarkerTree>, Directed> =
|
||||
Graph::with_capacity(resolution.packages.len(), resolution.packages.len());
|
||||
let mut inverse: FxHashMap<NodeKey, NodeIndex<u32>> = FxHashMap::with_capacity_and_hasher(
|
||||
resolution.packages.len(),
|
||||
BuildHasherDefault::default(),
|
||||
);
|
||||
let mut inverse: FxHashMap<NodeKey, NodeIndex<u32>> =
|
||||
FxHashMap::with_capacity_and_hasher(resolution.packages.len(), FxBuildHasher);
|
||||
let mut diagnostics = Vec::new();
|
||||
|
||||
// Add every package to the graph.
|
||||
|
@ -348,7 +345,7 @@ impl ResolutionGraph {
|
|||
}
|
||||
|
||||
/// Add all marker parameters from the given tree to the given set.
|
||||
fn add_marker_params_from_tree(marker_tree: &MarkerTree, set: &mut FxHashSet<MarkerParam>) {
|
||||
fn add_marker_params_from_tree(marker_tree: &MarkerTree, set: &mut IndexSet<MarkerParam>) {
|
||||
match marker_tree {
|
||||
MarkerTree::Expression(
|
||||
MarkerExpression::Version { key, .. }
|
||||
|
@ -378,7 +375,7 @@ impl ResolutionGraph {
|
|||
}
|
||||
}
|
||||
|
||||
let mut seen_marker_values = FxHashSet::default();
|
||||
let mut seen_marker_values = IndexSet::default();
|
||||
for i in self.petgraph.node_indices() {
|
||||
let dist = &self.petgraph[i];
|
||||
let version_id = match dist.version_or_url() {
|
||||
|
|
|
@ -7821,7 +7821,7 @@ fn emit_marker_expression_exciting_linux() -> Result<()> {
|
|||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in --emit-marker-expression
|
||||
# Pinned dependencies known to be valid for:
|
||||
# platform_system == 'Linux' and python_version == '3.12' and platform_python_implementation == 'CPython'
|
||||
# python_version == '3.12' and platform_python_implementation == 'CPython' and platform_system == 'Linux'
|
||||
anyio==4.3.0
|
||||
# via -r requirements.in
|
||||
idna==3.6
|
||||
|
@ -7858,7 +7858,7 @@ fn emit_marker_expression_direct() -> Result<()> {
|
|||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in --emit-marker-expression
|
||||
# Pinned dependencies known to be valid for:
|
||||
# python_version == '3.12' and platform_python_implementation == 'CPython' and sys_platform == 'linux' and platform_system == 'Linux'
|
||||
# python_version == '3.12' and platform_python_implementation == 'CPython' and platform_system == 'Linux' and sys_platform == 'linux'
|
||||
anyio==4.3.0
|
||||
# via -r requirements.in
|
||||
idna==3.6
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue