From 08abfdbb81c1ed4122eae4e3b65bc82e621e1b8f Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Sat, 14 Mar 2026 14:20:45 +0000 Subject: [PATCH] Use `settings::resolve_preview` for project validation (#18447) ## Summary The affected code was manually implementing part of the full logic which was already available in `settings::resolve_preview` so this PR just makes the project validation code use this function instead. ## Test Plan Existing test coverage. --- crates/uv/src/lib.rs | 8 ++++---- crates/uv/src/settings.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/uv/src/lib.rs b/crates/uv/src/lib.rs index 5ef816950..e3885a9c1 100644 --- a/crates/uv/src/lib.rs +++ b/crates/uv/src/lib.rs @@ -111,11 +111,11 @@ async fn run(mut cli: Cli) -> Result { if !skip_project_validation { if let Some(project_path) = cli.top_level.global_args.project.as_ref() { - // Resolve the preview flags until this becomes stabilized. We check CLI args and - // the `UV_PREVIEW` env var, but not workspace config (which requires reading from - // the project directory that may not exist). + // Resolve the preview flags until this becomes stabilized. We do + // not pass a workspace configuration as this would require reading + // from the project directory which might not exist. let preview = Preview::from_args( - cli.top_level.global_args.preview || environment.preview.value == Some(true), + settings::resolve_preview(&cli.top_level.global_args, None, &environment), cli.top_level.global_args.no_preview, &cli.top_level.global_args.preview_features, ); diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 7c0c2b851..bfe980ba8 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -213,7 +213,7 @@ fn resolve_python_preference( } /// Resolve the preview setting from CLI, environment, and workspace config. -fn resolve_preview( +pub(crate) fn resolve_preview( args: &GlobalArgs, workspace: Option<&FilesystemOptions>, environment: &EnvironmentOptions,