diff --git a/crates/uv-auth/src/cache.rs b/crates/uv-auth/src/cache.rs index 8221204c6c..0968877e62 100644 --- a/crates/uv-auth/src/cache.rs +++ b/crates/uv-auth/src/cache.rs @@ -185,9 +185,7 @@ impl CredentialsCache { // If we only have a username, add a new entry or replace an existing entry if it doesn't have a password let existing = realms.get(&key); - if existing.is_none() - || existing.is_some_and(|credentials| credentials.password().is_none()) - { + if existing.is_none_or(|credentials| credentials.password().is_none()) { return realms.insert(key, credentials.clone()); } diff --git a/crates/uv-build-backend/src/metadata.rs b/crates/uv-build-backend/src/metadata.rs index bd0b67cfcc..3fb788ae13 100644 --- a/crates/uv-build-backend/src/metadata.rs +++ b/crates/uv-build-backend/src/metadata.rs @@ -168,16 +168,17 @@ pub fn check_direct_build( // We can't validate the url. return Err(DirectBuildIncompatibility::UrlRequirement); } - Some(VersionOrUrl::VersionSpecifier(specifier)) => { + Some(VersionOrUrl::VersionSpecifier(specifier)) // If the user doesn't set an upper bound, we don't help them by not using the fast // path, their build may equally fail if the index version of `uv_build`, so we allow // missing upper bounds. - if !compatible.iter().any(|version| specifier.contains(version)) { - return Err(DirectBuildIncompatibility::IncompatibleRange( - specifier.clone(), - )); - } + if !compatible.iter().any(|version| specifier.contains(version)) => + { + return Err(DirectBuildIncompatibility::IncompatibleRange( + specifier.clone(), + )); } + Some(VersionOrUrl::VersionSpecifier(_)) => {} } Ok(()) diff --git a/crates/uv-build/rust-toolchain.toml b/crates/uv-build/rust-toolchain.toml index 9cf4a67c47..f25b5b1407 100644 --- a/crates/uv-build/rust-toolchain.toml +++ b/crates/uv-build/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.94.1" +channel = "1.95.0" diff --git a/crates/uv-macros/src/lib.rs b/crates/uv-macros/src/lib.rs index 8f50bfcbdc..f0c439b9f0 100644 --- a/crates/uv-macros/src/lib.rs +++ b/crates/uv-macros/src/lib.rs @@ -5,7 +5,7 @@ use quote::{quote, quote_spanned}; use syn::spanned::Spanned; use syn::{Attribute, DeriveInput, ImplItem, ItemImpl, LitStr, parse_macro_input}; -#[proc_macro_derive(OptionsMetadata, attributes(option, doc, option_group))] +#[proc_macro_derive(OptionsMetadata, attributes(option, option_group))] pub fn derive_options_metadata(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/uv-pypi-types/src/conflicts.rs b/crates/uv-pypi-types/src/conflicts.rs index a838cabf3e..db673bd588 100644 --- a/crates/uv-pypi-types/src/conflicts.rs +++ b/crates/uv-pypi-types/src/conflicts.rs @@ -172,7 +172,7 @@ impl Conflicts { graph .node_weight_mut(neighbor_idx) .expect("Graph node should have weight") - .extend(neighbor_canonical_items.into_iter()); + .extend(neighbor_canonical_items); } } @@ -197,7 +197,7 @@ impl Conflicts { } } } - conflict_sets.extend(new_conflict_sets.into_iter()); + conflict_sets.extend(new_conflict_sets); } // Add all newly discovered conflict sets (excluding the originals already in self.0) diff --git a/crates/uv-pypi-types/src/simple_json.rs b/crates/uv-pypi-types/src/simple_json.rs index a5569c72fb..c460367907 100644 --- a/crates/uv-pypi-types/src/simple_json.rs +++ b/crates/uv-pypi-types/src/simple_json.rs @@ -87,12 +87,10 @@ impl<'de> Deserialize<'de> for PypiFile { while let Some(key) = access.next_key::>()? { match &*key { - "core-metadata" | "dist-info-metadata" | "data-dist-info-metadata" => { - if core_metadata.is_none() { - core_metadata = access.next_value()?; - } else { - let _: serde::de::IgnoredAny = access.next_value()?; - } + "core-metadata" | "dist-info-metadata" | "data-dist-info-metadata" + if core_metadata.is_none() => + { + core_metadata = access.next_value()?; } "filename" => filename = Some(access.next_value()?), "hashes" => hashes = Some(access.next_value()?), @@ -190,12 +188,10 @@ impl<'de> Deserialize<'de> for PyxFile { while let Some(key) = access.next_key::>()? { match &*key { - "core-metadata" | "dist-info-metadata" | "data-dist-info-metadata" => { - if core_metadata.is_none() { - core_metadata = access.next_value()?; - } else { - let _: serde::de::IgnoredAny = access.next_value()?; - } + "core-metadata" | "dist-info-metadata" | "data-dist-info-metadata" + if core_metadata.is_none() => + { + core_metadata = access.next_value()?; } "filename" => filename = Some(access.next_value()?), "hashes" => hashes = Some(access.next_value()?), diff --git a/crates/uv-requirements/src/specification.rs b/crates/uv-requirements/src/specification.rs index afd3fcb6c7..33b550b768 100644 --- a/crates/uv-requirements/src/specification.rs +++ b/crates/uv-requirements/src/specification.rs @@ -658,7 +658,7 @@ impl RequirementsSpecification { } } } - spec.excludes.extend(source.excludes.into_iter()); + spec.excludes.extend(source.excludes); } Ok(spec) diff --git a/crates/uv-resolver/src/error.rs b/crates/uv-resolver/src/error.rs index b2261aba91..cd649c6a8a 100644 --- a/crates/uv-resolver/src/error.rs +++ b/crates/uv-resolver/src/error.rs @@ -968,26 +968,23 @@ fn collapse_unavailable_versions( other_versions, other_reason, )), - ) => { - // And the package and reason are the same... - if package == other_package && reason == other_reason { - // Collapse both into a new node, with a union of their ranges - let versions = other_versions.union(versions); - let mut terms = terms.clone(); - if let Some(Term::Positive(range)) = terms.get_mut(package) { - *range = versions.clone(); - } - *tree = DerivationTree::Derived(Derived { - terms, - shared_id: *shared_id, - cause1: cause1.clone(), - cause2: Arc::new(DerivationTree::External(External::Custom( - package.clone(), - versions, - reason.clone(), - ))), - }); + ) if package == other_package && reason == other_reason => { + // Collapse both into a new node, with a union of their ranges + let versions = other_versions.union(versions); + let mut terms = terms.clone(); + if let Some(Term::Positive(range)) = terms.get_mut(package) { + *range = versions.clone(); } + *tree = DerivationTree::Derived(Derived { + terms, + shared_id: *shared_id, + cause1: cause1.clone(), + cause2: Arc::new(DerivationTree::External(External::Custom( + package.clone(), + versions, + reason.clone(), + ))), + }); } ( DerivationTree::External(External::Custom( @@ -996,26 +993,23 @@ fn collapse_unavailable_versions( other_reason, )), _, - ) => { - // And the package and reason are the same... - if package == other_package && reason == other_reason { - // Collapse both into a new node, with a union of their ranges - let versions = other_versions.union(versions); - let mut terms = terms.clone(); - if let Some(Term::Positive(range)) = terms.get_mut(package) { - *range = versions.clone(); - } - *tree = DerivationTree::Derived(Derived { - terms, - shared_id: *shared_id, - cause1: Arc::new(DerivationTree::External(External::Custom( - package.clone(), - versions, - reason.clone(), - ))), - cause2: cause2.clone(), - }); + ) if package == other_package && reason == other_reason => { + // Collapse both into a new node, with a union of their ranges + let versions = other_versions.union(versions); + let mut terms = terms.clone(); + if let Some(Term::Positive(range)) = terms.get_mut(package) { + *range = versions.clone(); } + *tree = DerivationTree::Derived(Derived { + terms, + shared_id: *shared_id, + cause1: Arc::new(DerivationTree::External(External::Custom( + package.clone(), + versions, + reason.clone(), + ))), + cause2: cause2.clone(), + }); } _ => {} } diff --git a/crates/uv-resolver/src/pubgrub/report.rs b/crates/uv-resolver/src/pubgrub/report.rs index 7712d98c77..18eb538a39 100644 --- a/crates/uv-resolver/src/pubgrub/report.rs +++ b/crates/uv-resolver/src/pubgrub/report.rs @@ -177,7 +177,7 @@ impl ReportFormatter, UnavailableReason> let mut terms_vec: Vec<_> = terms.iter().collect(); // We avoid relying on hashmap iteration order here by always sorting // by package first. - terms_vec.sort_by(|&(pkg1, _), &(pkg2, _)| pkg1.cmp(pkg2)); + terms_vec.sort_by_key(|&(package, _)| package); match terms_vec.as_slice() { [] => "the requirements are unsatisfiable".into(), [(root, _)] if matches!(&**(*root), PubGrubPackageInner::Root(_)) => { @@ -515,7 +515,7 @@ impl PubGrubReportFormatter<'_> { let external1 = self.format_external(external1); let external2 = self.format_external(external2); - format!("{}and {}", padded("", &external1, " "), &external2,) + format!("{}and {}", padded("", &external1, " "), &external2) } } } @@ -1016,11 +1016,10 @@ impl PubGrubReportFormatter<'_> { // Add hints due to the package being entirely unavailable. match unavailable_packages.get(name) { - Some(UnavailablePackage::NoIndex) => { - if no_find_links { - hints.insert(PubGrubHint::NoIndex); - } + Some(UnavailablePackage::NoIndex) if no_find_links => { + hints.insert(PubGrubHint::NoIndex); } + Some(UnavailablePackage::NoIndex) => {} Some(UnavailablePackage::Offline) => { hints.insert(PubGrubHint::Offline); } diff --git a/crates/uv-resolver/src/resolution/requirements_txt.rs b/crates/uv-resolver/src/resolution/requirements_txt.rs index bfb4caef67..17bd452679 100644 --- a/crates/uv-resolver/src/resolution/requirements_txt.rs +++ b/crates/uv-resolver/src/resolution/requirements_txt.rs @@ -55,8 +55,8 @@ impl<'dist> RequirementsTxtDist<'dist> { Some(Scheme::File) => { if path .strip_prefix("//localhost") - .filter(|path| path.starts_with('/')) - .is_some() + .as_ref() + .is_some_and(|path| path.starts_with('/')) { // Always absolute; nothing to do. None diff --git a/crates/uv-workspace/src/workspace.rs b/crates/uv-workspace/src/workspace.rs index 11cadef052..a0de6b9b1a 100644 --- a/crates/uv-workspace/src/workspace.rs +++ b/crates/uv-workspace/src/workspace.rs @@ -919,8 +919,8 @@ impl Workspace { )?; let dev_dependencies_members = workspace_members - .iter() - .filter_map(|(_, member)| { + .values() + .filter_map(|member| { member .pyproject_toml .tool diff --git a/crates/uv/src/commands/pip/latest.rs b/crates/uv/src/commands/pip/latest.rs index 49ff6ad3fa..9227c45687 100644 --- a/crates/uv/src/commands/pip/latest.rs +++ b/crates/uv/src/commands/pip/latest.rs @@ -148,10 +148,8 @@ impl LatestClient<'_> { } match (latest.as_ref(), best) { - (Some(current), Some(best)) => { - if best.version() > current.version() { - latest = Some(best); - } + (Some(current), Some(best)) if best.version() > current.version() => { + latest = Some(best); } (None, Some(best)) => { latest = Some(best); diff --git a/crates/uv/src/commands/project/init.rs b/crates/uv/src/commands/project/init.rs index 64db72d0e5..f32c19bede 100644 --- a/crates/uv/src/commands/project/init.rs +++ b/crates/uv/src/commands/project/init.rs @@ -462,14 +462,14 @@ async fn init_project( if let Some(python_request) = python_pin { if PythonVersionFile::discover(path, &VersionFileDiscoveryOptions::default()) .await? - .filter(|file| { + .as_ref() + .is_none_or(|file| !{ file.version() .is_some_and(|version| *version == python_request) && file.path().parent().is_some_and(|parent| { parent == workspace.install_path() || parent == path }) }) - .is_none() { PythonVersionFile::new(path.join(".python-version")) .with_versions(vec![python_request.clone()]) @@ -483,8 +483,8 @@ async fn init_project( if PythonVersionFile::discover(path, &VersionFileDiscoveryOptions::default()) .await? .filter(|file| file.version().is_some()) - .filter(|file| file.path().parent().is_some_and(|parent| parent == path)) - .is_none() + .as_ref() + .is_none_or(|file| file.path().parent().is_none_or(|parent| parent != path)) { PythonVersionFile::new(path.join(".python-version")) .with_versions(vec![python_request.clone()]) diff --git a/crates/uv/src/commands/project/run.rs b/crates/uv/src/commands/project/run.rs index ee29b495d9..6f47762aa3 100644 --- a/crates/uv/src/commands/project/run.rs +++ b/crates/uv/src/commands/project/run.rs @@ -145,10 +145,8 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl RequirementsSource::SetupCfg(_) => { bail!("Adding requirements from a `setup.cfg` is not supported in `uv run`"); } - RequirementsSource::Extensionless(path) => { - if path == Path::new("-") { - requirements_from_stdin = true; - } + RequirementsSource::Extensionless(path) if path == Path::new("-") => { + requirements_from_stdin = true; } _ => {} } @@ -1305,20 +1303,14 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl .as_ref() .map(PythonEnvironment::scripts) .into_iter() - .chain( - requirements_env - .as_ref() - .map(PythonEnvironment::scripts) - .into_iter(), - ) + .chain(requirements_env.as_ref().map(PythonEnvironment::scripts)) .chain(std::iter::once(base_interpreter.scripts())) .chain( // On Windows, non-virtual Python distributions put `python.exe` in the top-level // directory, rather than in the `Scripts` subdirectory. cfg!(windows) .then(|| base_interpreter.sys_executable().parent()) - .flatten() - .into_iter(), + .flatten(), ) .dedup() .map(PathBuf::from) diff --git a/crates/uv/src/commands/tool/install.rs b/crates/uv/src/commands/tool/install.rs index 9f29888a42..60745b99d1 100644 --- a/crates/uv/src/commands/tool/install.rs +++ b/crates/uv/src/commands/tool/install.rs @@ -558,7 +558,7 @@ pub(crate) async fn install( constraints: constraints .iter() .cloned() - .chain(latest.into_iter()) + .chain(latest) .map(NameRequirementSpecification::from) .collect(), overrides: overrides diff --git a/crates/uv/src/commands/tool/run.rs b/crates/uv/src/commands/tool/run.rs index a5775dac78..f90b801609 100644 --- a/crates/uv/src/commands/tool/run.rs +++ b/crates/uv/src/commands/tool/run.rs @@ -1110,7 +1110,7 @@ async fn get_or_create_environment( .collect(), constraints: constraints .into_iter() - .chain(latest.into_iter()) + .chain(latest) .map(NameRequirementSpecification::from) .collect(), overrides: overrides diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 9845caf056..f0ab6dbf4e 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -163,17 +163,17 @@ pub(crate) fn resolve_color(args: &GlobalArgs) -> ColorChoice { // If `--no-color` is passed explicitly, disable color output. ColorChoice::Never } else if std::env::var_os(EnvVars::NO_COLOR) - .filter(|v| !v.is_empty()) - .is_some() + .as_ref() + .is_some_and(|v| !v.is_empty()) { // If the `NO_COLOR` is set, disable color output. ColorChoice::Never } else if std::env::var_os(EnvVars::FORCE_COLOR) - .filter(|v| !v.is_empty()) - .is_some() + .as_ref() + .is_some_and(|v| !v.is_empty()) || std::env::var_os(EnvVars::CLICOLOR_FORCE) - .filter(|v| !v.is_empty()) - .is_some() + .as_ref() + .is_some_and(|v| !v.is_empty()) { // If `FORCE_COLOR` or `CLICOLOR_FORCE` is set, always enable color output. ColorChoice::Always diff --git a/crates/uv/tests/it/network.rs b/crates/uv/tests/it/network.rs index 49575052a6..c3d8773bd8 100644 --- a/crates/uv/tests/it/network.rs +++ b/crates/uv/tests/it/network.rs @@ -182,7 +182,7 @@ async fn time_out_response( let (tx, rx) = tokio::sync::mpsc::channel(1); tokio::spawn(async move { let _ = tx.send(Ok(Frame::data(Bytes::new()))).await; - tokio::time::sleep(Duration::from_secs(60)).await; + tokio::time::sleep(Duration::from_mins(1)).await; }); let body = StreamBody::new(ReceiverStream::new(rx)).boxed(); Ok(hyper::Response::builder() diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9cf4a67c47..f25b5b1407 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.94.1" +channel = "1.95.0"