diff --git a/Cargo.lock b/Cargo.lock index 4ae2e27bb03f..c68161995a0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -392,7 +392,6 @@ dependencies = [ "distribution-filename", "distribution-types", "install-wheel-rs", - "once_cell", "pep508_rs", "platform-tags", "pypi-types", @@ -1097,7 +1096,6 @@ dependencies = [ "distribution-filename", "fs-err", "itertools 0.13.0", - "once_cell", "pep440_rs", "pep508_rs", "platform-tags", @@ -1824,7 +1822,6 @@ dependencies = [ "fs-err", "indoc", "mailparse", - "once_cell", "pathdiff", "pep440_rs", "platform-info", @@ -2425,7 +2422,6 @@ name = "pep440_rs" version = "0.6.0" dependencies = [ "indoc", - "once_cell", "pyo3", "rkyv", "serde", @@ -2441,7 +2437,6 @@ dependencies = [ "derivative", "insta", "log", - "once_cell", "pep440_rs", "pyo3", "pyo3-log", @@ -2792,7 +2787,6 @@ dependencies = [ "indexmap", "itertools 0.13.0", "mailparse", - "once_cell", "pep440_rs", "pep508_rs", "regex", @@ -4511,7 +4505,6 @@ dependencies = [ "http", "insta", "once-map", - "once_cell", "reqwest", "reqwest-middleware", "rust-netrc", @@ -4534,7 +4527,6 @@ dependencies = [ "indoc", "insta", "itertools 0.13.0", - "once_cell", "pep440_rs", "pep508_rs", "pypi-types", @@ -4756,7 +4748,6 @@ dependencies = [ "insta", "install-wheel-rs", "nanoid", - "once_cell", "path-absolutize", "pep440_rs", "pep508_rs", @@ -4820,7 +4811,6 @@ dependencies = [ "fs-err", "fs2", "junction", - "once_cell", "path-absolutize", "path-slash", "tempfile", @@ -4924,7 +4914,6 @@ dependencies = [ "indoc", "install-wheel-rs", "itertools 0.13.0", - "once_cell", "owo-colors", "pep440_rs", "pep508_rs", @@ -5053,7 +5042,6 @@ dependencies = [ "fs-err", "indoc", "memchr", - "once_cell", "pep440_rs", "pep508_rs", "pypi-types", @@ -5179,7 +5167,6 @@ name = "uv-warnings" version = "0.0.1" dependencies = [ "anstream", - "once_cell", "owo-colors", "rustc-hash 2.0.0", ] diff --git a/Cargo.toml b/Cargo.toml index e5218ef5c10e..3f3590ac7d3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ resolver = "2" [workspace.package] edition = "2021" -rust-version = "1.77" +rust-version = "1.80" homepage = "https://pypi.org/project/uv/" documentation = "https://pypi.org/project/uv/" repository = "https://github.com/astral-sh/uv" @@ -102,7 +102,6 @@ md-5 = { version = "0.10.6" } memchr = { version = "2.7.4" } miette = { version = "7.2.0" } nanoid = { version = "0.4.0" } -once_cell = { version = "1.19.0" } owo-colors = { version = "4.0.0" } path-absolutize = { version = "3.1.1" } path-slash = { version = "0.2.1" } diff --git a/crates/bench/Cargo.toml b/crates/bench/Cargo.toml index 1383b124aceb..9f6cb68fecad 100644 --- a/crates/bench/Cargo.toml +++ b/crates/bench/Cargo.toml @@ -48,7 +48,6 @@ anyhow = { workspace = true } chrono = { workspace = true } codspeed-criterion-compat = { version = "2.6.0", default-features = false, optional = true } criterion = { version = "0.5.1", default-features = false, features = ["async_tokio"] } -once_cell = { workspace = true } tokio = { workspace = true } [features] diff --git a/crates/bench/benches/uv.rs b/crates/bench/benches/uv.rs index 8f39edddc681..42c9d2fb804d 100644 --- a/crates/bench/benches/uv.rs +++ b/crates/bench/benches/uv.rs @@ -71,9 +71,10 @@ criterion_group!(uv, resolve_warm_airflow, resolve_warm_jupyter); criterion_main!(uv); mod resolver { + use std::sync::LazyLock; + use anyhow::Result; use chrono::NaiveDate; - use once_cell::sync::Lazy; use distribution_types::IndexLocations; use install_wheel_rs::linker::LinkMode; @@ -94,7 +95,7 @@ mod resolver { }; use uv_types::{BuildIsolation, EmptyInstalledPackages, HashStrategy, InFlight}; - static MARKERS: Lazy = Lazy::new(|| { + static MARKERS: LazyLock = LazyLock::new(|| { MarkerEnvironment::try_from(MarkerEnvironmentBuilder { implementation_name: "cpython", implementation_version: "3.11.5", @@ -118,8 +119,8 @@ mod resolver { Arch::Aarch64, ); - static TAGS: Lazy = - Lazy::new(|| Tags::from_env(&PLATFORM, (3, 11), "cpython", (3, 11), false).unwrap()); + static TAGS: LazyLock = + LazyLock::new(|| Tags::from_env(&PLATFORM, (3, 11), "cpython", (3, 11), false).unwrap()); pub(crate) async fn resolve( manifest: Manifest, diff --git a/crates/bench/src/lib.rs b/crates/bench/src/lib.rs index 951dd1fb7a11..be2bb72bf91f 100644 --- a/crates/bench/src/lib.rs +++ b/crates/bench/src/lib.rs @@ -2,9 +2,9 @@ pub mod criterion { //! This module re-exports the criterion API but picks the right backend depending on whether //! the benchmarks are built to run locally or with codspeed - #[cfg(not(codspeed))] + #[cfg(not(feature = "codspeed"))] pub use criterion::*; - #[cfg(codspeed)] + #[cfg(feature = "codspeed")] pub use codspeed_criterion_compat::*; } diff --git a/crates/distribution-types/Cargo.toml b/crates/distribution-types/Cargo.toml index d2b8cfada4fe..0b8990028dde 100644 --- a/crates/distribution-types/Cargo.toml +++ b/crates/distribution-types/Cargo.toml @@ -26,7 +26,6 @@ uv-normalize = { workspace = true } anyhow = { workspace = true } fs-err = { workspace = true } itertools = { workspace = true } -once_cell = { workspace = true } rkyv = { workspace = true } schemars = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"] } diff --git a/crates/distribution-types/src/index_url.rs b/crates/distribution-types/src/index_url.rs index ad11ca87e404..e88ec80ba6af 100644 --- a/crates/distribution-types/src/index_url.rs +++ b/crates/distribution-types/src/index_url.rs @@ -1,11 +1,10 @@ +use itertools::Either; use std::borrow::Cow; use std::fmt::{Display, Formatter}; use std::ops::Deref; use std::path::Path; use std::str::FromStr; - -use itertools::Either; -use once_cell::sync::Lazy; +use std::sync::LazyLock; use thiserror::Error; use url::{ParseError, Url}; @@ -13,10 +12,10 @@ use pep508_rs::{VerbatimUrl, VerbatimUrlError}; use crate::Verbatim; -static PYPI_URL: Lazy = Lazy::new(|| Url::parse("https://pypi.org/simple").unwrap()); +static PYPI_URL: LazyLock = LazyLock::new(|| Url::parse("https://pypi.org/simple").unwrap()); -static DEFAULT_INDEX_URL: Lazy = - Lazy::new(|| IndexUrl::Pypi(VerbatimUrl::from_url(PYPI_URL.clone()))); +static DEFAULT_INDEX_URL: LazyLock = + LazyLock::new(|| IndexUrl::Pypi(VerbatimUrl::from_url(PYPI_URL.clone()))); /// The URL of an index to use for fetching packages (e.g., PyPI). #[derive(Debug, Clone, Hash, Eq, PartialEq)] diff --git a/crates/install-wheel-rs/Cargo.toml b/crates/install-wheel-rs/Cargo.toml index c7eda5cbc075..7ca22b8ed5c6 100644 --- a/crates/install-wheel-rs/Cargo.toml +++ b/crates/install-wheel-rs/Cargo.toml @@ -34,7 +34,6 @@ csv = { workspace = true } data-encoding = { workspace = true } fs-err = { workspace = true } mailparse = { workspace = true } -once_cell = { workspace = true } pathdiff = { workspace = true } platform-info = { workspace = true } reflink-copy = { workspace = true } diff --git a/crates/install-wheel-rs/src/script.rs b/crates/install-wheel-rs/src/script.rs index eabe49363788..34039ad2cf0f 100644 --- a/crates/install-wheel-rs/src/script.rs +++ b/crates/install-wheel-rs/src/script.rs @@ -1,8 +1,8 @@ use configparser::ini::Ini; -use once_cell::sync::Lazy; use regex::Regex; use rustc_hash::FxHashSet; use serde::Serialize; +use std::sync::LazyLock; use crate::{wheel, Error}; @@ -30,7 +30,7 @@ impl Script { // between the object reference and the left square bracket, between the extra names and the square brackets and colons delimiting them, // and after the right square bracket." // – https://packaging.python.org/en/latest/specifications/entry-points/#file-format - static SCRIPT_REGEX: Lazy = Lazy::new(|| { + static SCRIPT_REGEX: LazyLock = LazyLock::new(|| { Regex::new(r"^(?P[\w\d_\-.]+)\s*:\s*(?P[\w\d_\-.]+)(?:\s*\[\s*(?P(?:[^,]+,?\s*)+)\])?\s*$").unwrap() }); diff --git a/crates/install-wheel-rs/src/uninstall.rs b/crates/install-wheel-rs/src/uninstall.rs index 45063f9554e6..a8aa69f43abe 100644 --- a/crates/install-wheel-rs/src/uninstall.rs +++ b/crates/install-wheel-rs/src/uninstall.rs @@ -2,8 +2,7 @@ use std::collections::BTreeSet; use std::path::{Component, Path, PathBuf}; use fs_err as fs; -use once_cell::sync::Lazy; -use std::sync::Mutex; +use std::sync::{LazyLock, Mutex}; use tracing::debug; use uv_fs::write_atomic_sync; @@ -219,7 +218,7 @@ fn normcase(s: &str) -> String { } } -static EASY_INSTALL_PTH: Lazy> = Lazy::new(Mutex::default); +static EASY_INSTALL_PTH: LazyLock> = LazyLock::new(Mutex::default); /// Uninstall the legacy editable represented by the `.egg-link` file. /// diff --git a/crates/pep440-rs/Cargo.toml b/crates/pep440-rs/Cargo.toml index 27df2a092ce2..4dd976a10048 100644 --- a/crates/pep440-rs/Cargo.toml +++ b/crates/pep440-rs/Cargo.toml @@ -19,7 +19,6 @@ crate-type = ["rlib", "cdylib"] workspace = true [dependencies] -once_cell = { workspace = true } pyo3 = { workspace = true, optional = true, features = ["extension-module", "abi3-py37"] } serde = { workspace = true, features = ["derive"] } rkyv = { workspace = true } diff --git a/crates/pep440-rs/src/version.rs b/crates/pep440-rs/src/version.rs index b73cc6501ea2..b1eab39f49a2 100644 --- a/crates/pep440-rs/src/version.rs +++ b/crates/pep440-rs/src/version.rs @@ -1,3 +1,10 @@ +#[cfg(feature = "pyo3")] +use pyo3::{ + basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny, + PyObject, PyResult, Python, +}; +use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; +use std::sync::LazyLock; use std::{ borrow::Borrow, cmp::Ordering, @@ -6,13 +13,6 @@ use std::{ sync::Arc, }; -#[cfg(feature = "pyo3")] -use pyo3::{ - basic::CompareOp, exceptions::PyValueError, pyclass, pymethods, FromPyObject, IntoPy, PyAny, - PyObject, PyResult, Python, -}; -use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - /// One of `~=` `==` `!=` `<=` `>=` `<` `>` `===` #[derive( Eq, @@ -821,8 +821,8 @@ impl FromStr for Version { /// * The epoch must be `0`. /// * The release portion must have 4 or fewer segments. /// * All release segments, except for the first, must be representable in a -/// `u8`. The first segment must be representable in a `u16`. (This permits -/// calendar versions, like `2023.03`, to be represented.) +/// `u8`. The first segment must be representable in a `u16`. (This permits +/// calendar versions, like `2023.03`, to be represented.) /// * There is *at most* one of the following components: pre, dev or post. /// * If there is a pre segment, then its numeric value is less than 64. /// * If there is a dev or post segment, then its value is less than `u8::MAX`. @@ -843,20 +843,20 @@ impl FromStr for Version { /// /// * Bytes 6 and 7 correspond to the first release segment as a `u16`. /// * Bytes 5, 4 and 3 correspond to the second, third and fourth release -/// segments, respectively. +/// segments, respectively. /// * Bytes 2, 1 and 0 represent *one* of the following: /// `min, .devN, aN, bN, rcN, , .postN, max`. /// Its representation is thus: /// * The most significant 3 bits of Byte 2 corresponds to a value in -/// the range 0-6 inclusive, corresponding to min, dev, pre-a, pre-b, pre-rc, -/// no-suffix or post releases, respectively. `min` is a special version that -/// does not exist in PEP 440, but is used here to represent the smallest -/// possible version, preceding any `dev`, `pre`, `post` or releases. `max` is -/// an analogous concept for the largest possible version, following any `post` -/// or local releases. +/// the range 0-6 inclusive, corresponding to min, dev, pre-a, pre-b, pre-rc, +/// no-suffix or post releases, respectively. `min` is a special version that +/// does not exist in PEP 440, but is used here to represent the smallest +/// possible version, preceding any `dev`, `pre`, `post` or releases. `max` is +/// an analogous concept for the largest possible version, following any `post` +/// or local releases. /// * The low 5 bits combined with the bits in bytes 1 and 0 correspond -/// to the release number of the suffix, if one exists. If there is no -/// suffix, then this bits are always 0. +/// to the release number of the suffix, if one exists. If there is no +/// suffix, then these bits are always 0. /// /// The order of the encoding above is significant. For example, suffixes are /// encoded at a less significant location than the release numbers, so that @@ -2532,8 +2532,8 @@ fn parse_u64(bytes: &[u8]) -> Result { } /// The minimum version that can be represented by a [`Version`]: `0a0.dev0`. -pub static MIN_VERSION: once_cell::sync::Lazy = - once_cell::sync::Lazy::new(|| Version::from_str("0a0.dev0").unwrap()); +pub static MIN_VERSION: LazyLock = + LazyLock::new(|| Version::from_str("0a0.dev0").unwrap()); #[cfg(test)] mod tests { diff --git a/crates/pep508-rs/Cargo.toml b/crates/pep508-rs/Cargo.toml index 8718af923fc1..44827003ca8d 100644 --- a/crates/pep508-rs/Cargo.toml +++ b/crates/pep508-rs/Cargo.toml @@ -21,7 +21,6 @@ workspace = true [dependencies] derivative = { workspace = true } -once_cell = { workspace = true } pep440_rs = { workspace = true } pyo3 = { workspace = true, optional = true, features = ["abi3", "extension-module"] } pyo3-log = { workspace = true, optional = true } diff --git a/crates/pep508-rs/src/verbatim_url.rs b/crates/pep508-rs/src/verbatim_url.rs index 1c14044a1320..b444b677d5c3 100644 --- a/crates/pep508-rs/src/verbatim_url.rs +++ b/crates/pep508-rs/src/verbatim_url.rs @@ -1,10 +1,9 @@ +use regex::Regex; use std::borrow::Cow; use std::fmt::Debug; use std::ops::Deref; use std::path::{Path, PathBuf}; - -use once_cell::sync::Lazy; -use regex::Regex; +use std::sync::LazyLock; use thiserror::Error; use url::{ParseError, Url}; @@ -301,13 +300,13 @@ pub enum VerbatimUrlError { pub fn expand_env_vars(s: &str) -> Cow<'_, str> { // Generate the project root, to be used via the `${PROJECT_ROOT}` // environment variable. - static PROJECT_ROOT_FRAGMENT: Lazy = Lazy::new(|| { + static PROJECT_ROOT_FRAGMENT: LazyLock = LazyLock::new(|| { let project_root = std::env::current_dir().unwrap(); project_root.to_string_lossy().to_string() }); - static RE: Lazy = - Lazy::new(|| Regex::new(r"(?P\$\{(?P[A-Z0-9_]+)})").unwrap()); + static RE: LazyLock = + LazyLock::new(|| Regex::new(r"(?P\$\{(?P[A-Z0-9_]+)})").unwrap()); RE.replace_all(s, |caps: ®ex::Captures<'_>| { let name = caps.name("name").unwrap().as_str(); diff --git a/crates/pypi-types/Cargo.toml b/crates/pypi-types/Cargo.toml index 475c683818cc..3345cb468631 100644 --- a/crates/pypi-types/Cargo.toml +++ b/crates/pypi-types/Cargo.toml @@ -22,7 +22,6 @@ chrono = { workspace = true, features = ["serde"] } indexmap = { workspace = true, features = ["serde"] } itertools = { workspace = true } mailparse = { workspace = true } -once_cell = { workspace = true } regex = { workspace = true } rkyv = { workspace = true } serde = { workspace = true } diff --git a/crates/pypi-types/src/lenient_requirement.rs b/crates/pypi-types/src/lenient_requirement.rs index 1e05825583c3..ebca27ab65bd 100644 --- a/crates/pypi-types/src/lenient_requirement.rs +++ b/crates/pypi-types/src/lenient_requirement.rs @@ -1,9 +1,8 @@ -use std::borrow::Cow; -use std::str::FromStr; - -use once_cell::sync::Lazy; use regex::Regex; use serde::{de, Deserialize, Deserializer, Serialize}; +use std::borrow::Cow; +use std::str::FromStr; +use std::sync::LazyLock; use tracing::warn; use pep440_rs::{VersionSpecifiers, VersionSpecifiersParseError}; @@ -12,21 +11,22 @@ use pep508_rs::{Pep508Error, Pep508Url, Requirement}; use crate::VerbatimParsedUrl; /// Ex) `>=7.2.0<8.0.0` -static MISSING_COMMA: Lazy = Lazy::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap()); +static MISSING_COMMA: LazyLock = LazyLock::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap()); /// Ex) `!=~5.0` -static NOT_EQUAL_TILDE: Lazy = Lazy::new(|| Regex::new(r"!=~((?:\d\.)*\d)").unwrap()); +static NOT_EQUAL_TILDE: LazyLock = + LazyLock::new(|| Regex::new(r"!=~((?:\d\.)*\d)").unwrap()); /// Ex) `>=1.9.*`, `<3.4.*` -static INVALID_TRAILING_DOT_STAR: Lazy = - Lazy::new(|| Regex::new(r"(<=|>=|<|>)(\d+(\.\d+)*)\.\*").unwrap()); +static INVALID_TRAILING_DOT_STAR: LazyLock = + LazyLock::new(|| Regex::new(r"(<=|>=|<|>)(\d+(\.\d+)*)\.\*").unwrap()); /// Ex) `!=3.0*` -static MISSING_DOT: Lazy = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap()); +static MISSING_DOT: LazyLock = LazyLock::new(|| Regex::new(r"(\d\.\d)+\*").unwrap()); /// Ex) `>=3.6,` -static TRAILING_COMMA: Lazy = Lazy::new(|| Regex::new(r",\s*$").unwrap()); +static TRAILING_COMMA: LazyLock = LazyLock::new(|| Regex::new(r",\s*$").unwrap()); /// Ex) `>dev` -static GREATER_THAN_DEV: Lazy = Lazy::new(|| Regex::new(r">dev").unwrap()); +static GREATER_THAN_DEV: LazyLock = LazyLock::new(|| Regex::new(r">dev").unwrap()); /// Ex) `>=9.0.0a1.0` -static TRAILING_ZERO: Lazy = - Lazy::new(|| Regex::new(r"(\d+(\.\d)*(a|b|rc|post|dev)\d+)\.0").unwrap()); +static TRAILING_ZERO: LazyLock = + LazyLock::new(|| Regex::new(r"(\d+(\.\d)*(a|b|rc|post|dev)\d+)\.0").unwrap()); // Search and replace functions that fix invalid specifiers. type FixUp = for<'a> fn(&'a str) -> Cow<'a, str>; @@ -74,7 +74,7 @@ static FIXUPS: &[(FixUp, &str)] = &[ // Given `>= 2.7'`, rewrite to `>= 2.7` fn remove_stray_quotes(input: &str) -> Cow<'_, str> { /// Ex) `'>= 2.7'`, `>=3.6'` - static STRAY_QUOTES: Lazy = Lazy::new(|| Regex::new(r#"['"]"#).unwrap()); + static STRAY_QUOTES: LazyLock = LazyLock::new(|| Regex::new(r#"['"]"#).unwrap()); // make sure not to touch markers, which can have quotes (e.g. `python_version >= '3.7'`) match input.find(';') { diff --git a/crates/uv-auth/Cargo.toml b/crates/uv-auth/Cargo.toml index 42c2a73a5563..a909f454a2d6 100644 --- a/crates/uv-auth/Cargo.toml +++ b/crates/uv-auth/Cargo.toml @@ -12,7 +12,6 @@ async-trait = { workspace = true } base64 = { workspace = true } futures = { workspace = true } http = { workspace = true } -once_cell = { workspace = true } once-map = { workspace = true } reqwest = { workspace = true } reqwest-middleware = { workspace = true } diff --git a/crates/uv-auth/src/lib.rs b/crates/uv-auth/src/lib.rs index 6d6ea2bd40d9..947b6aa8320a 100644 --- a/crates/uv-auth/src/lib.rs +++ b/crates/uv-auth/src/lib.rs @@ -4,14 +4,13 @@ mod keyring; mod middleware; mod realm; -use std::sync::Arc; +use std::sync::{Arc, LazyLock}; use cache::CredentialsCache; use credentials::Credentials; pub use keyring::KeyringProvider; pub use middleware::AuthMiddleware; -use once_cell::sync::Lazy; use realm::Realm; use tracing::trace; use url::Url; @@ -21,7 +20,8 @@ use url::Url; /// Global authentication cache for a uv invocation /// /// This is used to share credentials across uv clients. -pub(crate) static CREDENTIALS_CACHE: Lazy = Lazy::new(CredentialsCache::default); +pub(crate) static CREDENTIALS_CACHE: LazyLock = + LazyLock::new(CredentialsCache::default); /// Populate the global authentication store with credentials on a URL, if there are any. /// diff --git a/crates/uv-build/Cargo.toml b/crates/uv-build/Cargo.toml index de0fb312e230..ef9ed1a47e36 100644 --- a/crates/uv-build/Cargo.toml +++ b/crates/uv-build/Cargo.toml @@ -28,7 +28,6 @@ anyhow = { workspace = true } fs-err = { workspace = true } indoc = { workspace = true } itertools = { workspace = true } -once_cell = { workspace = true } regex = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/uv-build/src/lib.rs b/crates/uv-build/src/lib.rs index c9a98a6946bb..d629b19c0ea7 100644 --- a/crates/uv-build/src/lib.rs +++ b/crates/uv-build/src/lib.rs @@ -2,6 +2,13 @@ //! //! +use fs_err as fs; +use indoc::formatdoc; +use itertools::Itertools; +use regex::Regex; +use rustc_hash::FxHashMap; +use serde::de::{value, SeqAccess, Visitor}; +use serde::{de, Deserialize, Deserializer}; use std::ffi::OsString; use std::fmt::{Display, Formatter}; use std::io; @@ -9,16 +16,8 @@ use std::path::{Path, PathBuf}; use std::process::{ExitStatus, Output}; use std::rc::Rc; use std::str::FromStr; +use std::sync::LazyLock; use std::{env, iter}; - -use fs_err as fs; -use indoc::formatdoc; -use itertools::Itertools; -use once_cell::sync::Lazy; -use regex::Regex; -use rustc_hash::FxHashMap; -use serde::de::{value, SeqAccess, Visitor}; -use serde::{de, Deserialize, Deserializer}; use tempfile::{tempdir_in, TempDir}; use thiserror::Error; use tokio::process::Command; @@ -35,7 +34,7 @@ use uv_python::{Interpreter, PythonEnvironment}; use uv_types::{BuildContext, BuildIsolation, SourceBuildTrait}; /// e.g. `pygraphviz/graphviz_wrap.c:3020:10: fatal error: graphviz/cgraph.h: No such file or directory` -static MISSING_HEADER_RE_GCC: Lazy = Lazy::new(|| { +static MISSING_HEADER_RE_GCC: LazyLock = LazyLock::new(|| { Regex::new( r".*\.(?:c|c..|h|h..):\d+:\d+: fatal error: (.*\.(?:h|h..)): No such file or directory", ) @@ -43,32 +42,32 @@ static MISSING_HEADER_RE_GCC: Lazy = Lazy::new(|| { }); /// e.g. `pygraphviz/graphviz_wrap.c:3023:10: fatal error: 'graphviz/cgraph.h' file not found` -static MISSING_HEADER_RE_CLANG: Lazy = Lazy::new(|| { +static MISSING_HEADER_RE_CLANG: LazyLock = LazyLock::new(|| { Regex::new(r".*\.(?:c|c..|h|h..):\d+:\d+: fatal error: '(.*\.(?:h|h..))' file not found") .unwrap() }); /// e.g. `pygraphviz/graphviz_wrap.c(3023): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory` -static MISSING_HEADER_RE_MSVC: Lazy = Lazy::new(|| { +static MISSING_HEADER_RE_MSVC: LazyLock = LazyLock::new(|| { Regex::new(r".*\.(?:c|c..|h|h..)\(\d+\): fatal error C1083: Cannot open include file: '(.*\.(?:h|h..))': No such file or directory") .unwrap() }); /// e.g. `/usr/bin/ld: cannot find -lncurses: No such file or directory` -static LD_NOT_FOUND_RE: Lazy = Lazy::new(|| { +static LD_NOT_FOUND_RE: LazyLock = LazyLock::new(|| { Regex::new(r"/usr/bin/ld: cannot find -l([a-zA-Z10-9]+): No such file or directory").unwrap() }); /// e.g. `error: invalid command 'bdist_wheel'` -static WHEEL_NOT_FOUND_RE: Lazy = - Lazy::new(|| Regex::new(r"error: invalid command 'bdist_wheel'").unwrap()); +static WHEEL_NOT_FOUND_RE: LazyLock = + LazyLock::new(|| Regex::new(r"error: invalid command 'bdist_wheel'").unwrap()); /// e.g. `ModuleNotFoundError: No module named 'torch'` -static TORCH_NOT_FOUND_RE: Lazy = - Lazy::new(|| Regex::new(r"ModuleNotFoundError: No module named 'torch'").unwrap()); +static TORCH_NOT_FOUND_RE: LazyLock = + LazyLock::new(|| Regex::new(r"ModuleNotFoundError: No module named 'torch'").unwrap()); /// The default backend to use when PEP 517 is used without a `build-system` section. -static DEFAULT_BACKEND: Lazy = Lazy::new(|| Pep517Backend { +static DEFAULT_BACKEND: LazyLock = LazyLock::new(|| Pep517Backend { backend: "setuptools.build_meta:__legacy__".to_string(), backend_path: None, requirements: vec![Requirement::from( @@ -77,7 +76,7 @@ static DEFAULT_BACKEND: Lazy = Lazy::new(|| Pep517Backend { }); /// The requirements for `--legacy-setup-py` builds. -static SETUP_PY_REQUIREMENTS: Lazy<[Requirement; 2]> = Lazy::new(|| { +static SETUP_PY_REQUIREMENTS: LazyLock<[Requirement; 2]> = LazyLock::new(|| { [ Requirement::from(pep508_rs::Requirement::from_str("setuptools >= 40.8.0").unwrap()), Requirement::from(pep508_rs::Requirement::from_str("wheel").unwrap()), diff --git a/crates/uv-client/src/httpcache/mod.rs b/crates/uv-client/src/httpcache/mod.rs index eba46c92a6bf..8af2df8caeaa 100644 --- a/crates/uv-client/src/httpcache/mod.rs +++ b/crates/uv-client/src/httpcache/mod.rs @@ -5,11 +5,11 @@ This implementation was guided by the following things: * RFCs 9110 and 9111. * The `http-cache-semantics` crate. (The implementation here is completely -different, but the source of `http-cache-semantics` helped guide the -implementation here and understanding of HTTP caching.) + different, but the source of `http-cache-semantics` helped guide the + implementation here and understanding of HTTP caching.) * A desire for our cache policy to support zero-copy deserialization. That -is, we want the cached response fast path (where no revalidation request is -necessary) to avoid any costly deserialization for the cache policy at all. + is, we want the cached response fast path (where no revalidation request is + necessary) to avoid any costly deserialization for the cache policy at all. # Flow @@ -33,13 +33,13 @@ the server for a fresh response. In our case, the main utility of `max-age` is two fold: * PyPI sets a `max-age` of 600 seconds (10 minutes) on its responses. As long -as our cached responses have an age less than this, we can completely avoid -talking to PyPI at all when we need access to the full set of versions for a -package. + as our cached responses have an age less than this, we can completely avoid + talking to PyPI at all when we need access to the full set of versions for a + package. * Most other assets, like wheels, are forever immutable. They will never -change. So servers will typically set a very high `max-age`, which means we -will almost never need to ask the server for permission to reuse our cached -wheel. + change. So servers will typically set a very high `max-age`, which means we + will almost never need to ask the server for permission to reuse our cached + wheel. When a cached response exceeds the `max-age` configured on a response, then we call that response stale. Generally speaking, we won't return responses @@ -295,14 +295,14 @@ impl ArchivedCachePolicy { /// This returns one of three possible behaviors: /// /// 1. The cached response is still fresh, and the caller may return - /// the cached response without issuing an HTTP requests. + /// the cached response without issuing an HTTP requests. /// 2. The cached response is stale. The caller should send a re-validation - /// request and then call `CachePolicy::after_response` to determine whether - /// the cached response is actually fresh, or if it's stale and needs to - /// be updated. + /// request and then call `CachePolicy::after_response` to determine whether + /// the cached response is actually fresh, or if it's stale and needs to + /// be updated. /// 3. The given request does not match the cache policy identification. - /// Generally speaking, this usually implies a bug with the cache in that - /// it loaded a cache policy that does not match the request. + /// Generally speaking, this usually implies a bug with the cache in that + /// it loaded a cache policy that does not match the request. /// /// In the case of (2), the given request is modified in place such that /// it is suitable as a revalidation request. diff --git a/crates/uv-distribution/Cargo.toml b/crates/uv-distribution/Cargo.toml index 8fc190a70ea1..6fc8b98bd6e0 100644 --- a/crates/uv-distribution/Cargo.toml +++ b/crates/uv-distribution/Cargo.toml @@ -35,7 +35,6 @@ anyhow = { workspace = true } fs-err = { workspace = true } futures = { workspace = true } nanoid = { workspace = true } -once_cell = { workspace = true } path-absolutize = { workspace = true } reqwest = { workspace = true } reqwest-middleware = { workspace = true } diff --git a/crates/uv-distribution/src/metadata/requires_dist.rs b/crates/uv-distribution/src/metadata/requires_dist.rs index d30d61449043..3d451c9e982f 100644 --- a/crates/uv-distribution/src/metadata/requires_dist.rs +++ b/crates/uv-distribution/src/metadata/requires_dist.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use std::path::Path; - -use once_cell::sync::Lazy; +use std::sync::LazyLock; use uv_configuration::PreviewMode; use uv_normalize::{ExtraName, GroupName, PackageName}; @@ -15,8 +14,8 @@ use crate::Metadata; /// /// Internally, we model dependency groups as a generic concept; but externally, we only expose the /// `dev-dependencies` group. -pub static DEV_DEPENDENCIES: Lazy = - Lazy::new(|| GroupName::new("dev".to_string()).unwrap()); +pub static DEV_DEPENDENCIES: LazyLock = + LazyLock::new(|| GroupName::new("dev".to_string()).unwrap()); #[derive(Debug, Clone)] pub struct RequiresDist { diff --git a/crates/uv-fs/Cargo.toml b/crates/uv-fs/Cargo.toml index 7efdd437dcda..80fe09773ea1 100644 --- a/crates/uv-fs/Cargo.toml +++ b/crates/uv-fs/Cargo.toml @@ -22,7 +22,6 @@ either = { workspace = true } encoding_rs_io = { workspace = true } fs-err = { workspace = true } fs2 = { workspace = true } -once_cell = { workspace = true } path-absolutize = { workspace = true } path-slash = { workspace = true } tempfile = { workspace = true } diff --git a/crates/uv-fs/src/path.rs b/crates/uv-fs/src/path.rs index f0e0a10c3967..e9ff20dbb064 100644 --- a/crates/uv-fs/src/path.rs +++ b/crates/uv-fs/src/path.rs @@ -1,16 +1,16 @@ -use either::Either; use std::borrow::Cow; use std::path::{Component, Path, PathBuf}; +use std::sync::LazyLock; -use once_cell::sync::Lazy; +use either::Either; use path_slash::PathExt; /// The current working directory. -pub static CWD: Lazy = - Lazy::new(|| std::env::current_dir().expect("The current directory must exist")); +pub static CWD: LazyLock = + LazyLock::new(|| std::env::current_dir().expect("The current directory must exist")); /// The current working directory, canonicalized. -pub static CANONICAL_CWD: Lazy = Lazy::new(|| { +pub static CANONICAL_CWD: LazyLock = LazyLock::new(|| { std::env::current_dir() .expect("The current directory must exist") .canonicalize() diff --git a/crates/uv-python/Cargo.toml b/crates/uv-python/Cargo.toml index e0de8b6350d4..706f88902ebd 100644 --- a/crates/uv-python/Cargo.toml +++ b/crates/uv-python/Cargo.toml @@ -33,7 +33,6 @@ configparser = { workspace = true } fs-err = { workspace = true, features = ["tokio"] } futures = { workspace = true } itertools = { workspace = true } -once_cell = { workspace = true } owo-colors = { workspace = true } regex = { workspace = true } reqwest = { workspace = true } diff --git a/crates/uv-python/src/interpreter.rs b/crates/uv-python/src/interpreter.rs index 3172e526b64f..55e3ba4a04ca 100644 --- a/crates/uv-python/src/interpreter.rs +++ b/crates/uv-python/src/interpreter.rs @@ -2,10 +2,10 @@ use std::borrow::Cow; use std::io; use std::path::{Path, PathBuf}; use std::process::{Command, ExitStatus}; +use std::sync::OnceLock; use configparser::ini::Ini; use fs_err as fs; -use once_cell::sync::OnceCell; use same_file::is_same_file; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -40,7 +40,7 @@ pub struct Interpreter { sys_executable: PathBuf, sys_path: Vec, stdlib: PathBuf, - tags: OnceCell, + tags: OnceLock, target: Option, prefix: Option, pointer_size: PointerSize, @@ -72,7 +72,7 @@ impl Interpreter { sys_executable: info.sys_executable, sys_path: info.sys_path, stdlib: info.stdlib, - tags: OnceCell::new(), + tags: OnceLock::new(), target: None, prefix: None, }) @@ -104,7 +104,7 @@ impl Interpreter { sys_executable: PathBuf::from("/dev/null"), sys_path: vec![], stdlib: PathBuf::from("/dev/null"), - tags: OnceCell::new(), + tags: OnceLock::new(), target: None, prefix: None, pointer_size: PointerSize::_64, @@ -204,15 +204,17 @@ impl Interpreter { /// Returns the [`Tags`] for this Python executable. pub fn tags(&self) -> Result<&Tags, TagsError> { - self.tags.get_or_try_init(|| { - Tags::from_env( + if self.tags.get().is_none() { + let tags = Tags::from_env( self.platform(), self.python_tuple(), self.implementation_name(), self.implementation_tuple(), self.gil_disabled, - ) - }) + )?; + self.tags.set(tags).expect("tags should not be set"); + } + Ok(self.tags.get().expect("tags should be set")) } /// Returns `true` if the environment is a PEP 405-compliant virtual environment. diff --git a/crates/uv-python/src/py_launcher.rs b/crates/uv-python/src/py_launcher.rs index 213d3f53291c..e7cc4a7b7625 100644 --- a/crates/uv-python/src/py_launcher.rs +++ b/crates/uv-python/src/py_launcher.rs @@ -1,9 +1,8 @@ +use regex::Regex; use std::io; use std::path::PathBuf; use std::process::{Command, ExitStatus}; - -use once_cell::sync::Lazy; -use regex::Regex; +use std::sync::LazyLock; use thiserror::Error; use tracing::info_span; @@ -34,7 +33,7 @@ pub enum Error { /// -V:3.12 C:\Users\Ferris\AppData\Local\Programs\Python\Python312\python.exe /// -V:3.8 C:\Users\Ferris\AppData\Local\Programs\Python\Python38\python.exe /// ``` -static PY_LIST_PATHS: Lazy = Lazy::new(|| { +static PY_LIST_PATHS: LazyLock = LazyLock::new(|| { // Without the `R` flag, paths have trailing \r Regex::new(r"(?mR)^ -(?:V:)?(\d).(\d+)-?(?:arm)?\d*\s*\*?\s*(.*)$").unwrap() }); diff --git a/crates/uv-scripts/Cargo.toml b/crates/uv-scripts/Cargo.toml index 5ccd5035d454..54a6873b86c4 100644 --- a/crates/uv-scripts/Cargo.toml +++ b/crates/uv-scripts/Cargo.toml @@ -14,7 +14,6 @@ pypi-types = { workspace = true } fs-err = { workspace = true, features = ["tokio"] } memchr = { workspace = true } -once_cell = { workspace = true } serde = { workspace = true, features = ["derive"] } thiserror = { workspace = true } toml = { workspace = true } diff --git a/crates/uv-scripts/src/lib.rs b/crates/uv-scripts/src/lib.rs index cc21d910f1b4..46263eb1dfcc 100644 --- a/crates/uv-scripts/src/lib.rs +++ b/crates/uv-scripts/src/lib.rs @@ -1,13 +1,12 @@ -use std::io; -use std::path::Path; - use memchr::memmem::Finder; -use once_cell::sync::Lazy; use pypi_types::VerbatimParsedUrl; use serde::{Deserialize, Serialize}; +use std::io; +use std::path::Path; +use std::sync::LazyLock; use thiserror::Error; -static FINDER: Lazy = Lazy::new(|| Finder::new(b"# /// script")); +static FINDER: LazyLock = LazyLock::new(|| Finder::new(b"# /// script")); /// PEP 723 metadata as parsed from a `script` comment block. /// diff --git a/crates/uv-trampoline/Cargo.lock b/crates/uv-trampoline/Cargo.lock index 4dffd0d6f47d..099279d6d107 100644 --- a/crates/uv-trampoline/Cargo.lock +++ b/crates/uv-trampoline/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -34,33 +34,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys", @@ -74,9 +74,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "assert_cmd" -version = "2.0.14" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" +checksum = "bc65048dd435533bb1baf2ed9956b9a278fbfdcf90301b39ee117f06c0199d37" dependencies = [ "anstyle", "bstr", @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "assert_fs" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd762e110c8ed629b11b6cde59458cc1c71de78ebbcc30099fc8e0403a2a2ec" +checksum = "7efdb1fdb47602827a342857666feb372712cbc64b414172bd6b167a02927674" dependencies = [ "anstyle", "doc-comment", @@ -127,9 +127,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bstr" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", "regex-automata", @@ -159,9 +159,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "crc32fast" @@ -361,9 +361,9 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "junction" @@ -458,9 +458,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "predicates" -version = "3.1.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" dependencies = [ "anstyle", "difflib", @@ -469,15 +469,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" [[package]] name = "predicates-tree" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" dependencies = [ "predicates-core", "termtree", @@ -485,18 +485,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -599,7 +599,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.72", ] [[package]] @@ -615,9 +615,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -659,7 +659,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.72", ] [[package]] @@ -681,7 +681,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.72", ] [[package]] @@ -750,7 +750,6 @@ dependencies = [ "fs-err", "fs2", "junction", - "once_cell", "path-absolutize", "path-slash", "tempfile", @@ -782,7 +781,6 @@ name = "uv-warnings" version = "0.0.1" dependencies = [ "anstream", - "once_cell", "owo-colors", "rustc-hash", ] @@ -886,7 +884,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.72", ] [[package]] @@ -897,7 +895,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.72", ] [[package]] diff --git a/crates/uv-warnings/Cargo.toml b/crates/uv-warnings/Cargo.toml index ddf7864b878a..c5b281e2ed39 100644 --- a/crates/uv-warnings/Cargo.toml +++ b/crates/uv-warnings/Cargo.toml @@ -14,6 +14,5 @@ workspace = true [dependencies] anstream = { workspace = true } -once_cell = { workspace = true } owo-colors = { workspace = true } rustc-hash = { workspace = true } diff --git a/crates/uv-warnings/src/lib.rs b/crates/uv-warnings/src/lib.rs index 1c2a49edbec1..9ed4c646ea1b 100644 --- a/crates/uv-warnings/src/lib.rs +++ b/crates/uv-warnings/src/lib.rs @@ -1,10 +1,9 @@ use std::sync::atomic::AtomicBool; -use std::sync::Mutex; +use std::sync::{LazyLock, Mutex}; // macro hygiene: The user might not have direct dependencies on those crates #[doc(hidden)] pub use anstream; -use once_cell::sync::Lazy; #[doc(hidden)] pub use owo_colors; use rustc_hash::FxHashSet; @@ -37,7 +36,7 @@ macro_rules! warn_user { }; } -pub static WARNINGS: Lazy>> = Lazy::new(Mutex::default); +pub static WARNINGS: LazyLock>> = LazyLock::new(Mutex::default); /// Warn a user once, if warnings are enabled, with uniqueness determined by the content of the /// message. diff --git a/crates/uv/src/commands/project/mod.rs b/crates/uv/src/commands/project/mod.rs index 735e92423ec2..300aa7c80b76 100644 --- a/crates/uv/src/commands/project/mod.rs +++ b/crates/uv/src/commands/project/mod.rs @@ -137,6 +137,7 @@ fn interpreter_meets_requirements( } #[derive(Debug)] +#[allow(clippy::large_enum_variant)] pub(crate) enum FoundInterpreter { Interpreter(Interpreter), Environment(PythonEnvironment), diff --git a/crates/uv/tests/common/mod.rs b/crates/uv/tests/common/mod.rs index abdeb32359d5..7d9b30d19f95 100644 --- a/crates/uv/tests/common/mod.rs +++ b/crates/uv/tests/common/mod.rs @@ -232,7 +232,7 @@ impl TestContext { // And for the symlink we created in the test the Python path filters.extend( - Self::path_patterns(&python_dir.join(version.to_string())) + Self::path_patterns(python_dir.join(version.to_string())) .into_iter() .map(|pattern| { ( @@ -338,7 +338,7 @@ impl TestContext { .env("UV_NO_WRAP", "1") .env("HOME", self.home_dir.as_os_str()) .env("UV_PYTHON_INSTALL_DIR", "") - .env("UV_TEST_PYTHON_PATH", &self.python_path()) + .env("UV_TEST_PYTHON_PATH", self.python_path()) .env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER) .current_dir(self.temp_dir.path()); diff --git a/crates/uv/tests/pip_compile.rs b/crates/uv/tests/pip_compile.rs index f8dbbd9f21b4..ffbeb08399b9 100644 --- a/crates/uv/tests/pip_compile.rs +++ b/crates/uv/tests/pip_compile.rs @@ -3117,7 +3117,7 @@ fn override_dependency_from_specific_uv_toml() -> Result<()> { .arg("pyproject.toml") .arg("--config-file") .arg("../uv/uv.toml") - .current_dir(&context.temp_dir.child("project")) + .current_dir(context.temp_dir.child("project")) , @r###" success: true exit_code: 0 diff --git a/crates/uv/tests/workspace.rs b/crates/uv/tests/workspace.rs index 83085fed2ada..281773adf451 100644 --- a/crates/uv/tests/workspace.rs +++ b/crates/uv/tests/workspace.rs @@ -530,7 +530,7 @@ fn workspace_lock_idempotence(workspace: &str, subdirectories: &[&str]) -> Resul context .lock() .arg("--preview") - .current_dir(&work_dir.join(dir)) + .current_dir(work_dir.join(dir)) .assert() .success(); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c6e4d7d5031f..8cca5be0594d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.79" +channel = "1.80"