From bfb4d2804d57796ab0fcf5e9a9fa3b156c64e877 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 7 Apr 2026 14:47:08 -0400 Subject: [PATCH] Convert Clippy allows to expects (#18906) --- crates/uv-distribution/src/source/mod.rs | 2 +- crates/uv-extract/src/vendor/cloneable_seekable_reader.rs | 2 +- crates/uv-fs/src/link.rs | 2 +- crates/uv-globfilter/src/main.rs | 2 +- crates/uv-resolver/src/lock/mod.rs | 3 +-- crates/uv-test/src/lib.rs | 3 +-- crates/uv-trampoline/src/bounce.rs | 1 - crates/uv-windows/src/spawn.rs | 2 +- crates/uv/src/commands/project/lock.rs | 2 +- crates/uv/src/windows_exception.rs | 2 +- crates/uv/tests/it/edit.rs | 2 +- crates/uv/tests/it/export.rs | 2 +- crates/uv/tests/it/lock_scenarios.rs | 5 ++--- crates/uv/tests/it/pip_compile.rs | 2 +- crates/uv/tests/it/run.rs | 2 +- scripts/scenarios/templates/lock.mustache | 5 ++--- 16 files changed, 17 insertions(+), 22 deletions(-) diff --git a/crates/uv-distribution/src/source/mod.rs b/crates/uv-distribution/src/source/mod.rs index 5ee7c95fd..e45c9e38b 100644 --- a/crates/uv-distribution/src/source/mod.rs +++ b/crates/uv-distribution/src/source/mod.rs @@ -6,7 +6,7 @@ // instead. But that's a monster. On the other hand, applying this suppression // instruction more granularly is annoying. So we just slap it on the module // for now. ---AG -#![allow(clippy::redundant_closure_for_method_calls)] +#![expect(clippy::redundant_closure_for_method_calls)] use std::borrow::Cow; use std::ops::Bound; diff --git a/crates/uv-extract/src/vendor/cloneable_seekable_reader.rs b/crates/uv-extract/src/vendor/cloneable_seekable_reader.rs index 5bc0a849c..f62e8f0e9 100644 --- a/crates/uv-extract/src/vendor/cloneable_seekable_reader.rs +++ b/crates/uv-extract/src/vendor/cloneable_seekable_reader.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(clippy::cast_sign_loss)] +#![expect(clippy::cast_sign_loss)] use std::{ io::{BufReader, Cursor, Read, Seek, SeekFrom}, diff --git a/crates/uv-fs/src/link.rs b/crates/uv-fs/src/link.rs index 579e1f2fe..c13308809 100644 --- a/crates/uv-fs/src/link.rs +++ b/crates/uv-fs/src/link.rs @@ -905,7 +905,7 @@ fn create_symlink(original: &Path, link: &Path) -> io::Result<()> { } #[cfg(test)] -#[allow(clippy::print_stderr)] +#[expect(clippy::print_stderr)] mod tests { use super::*; use tempfile::TempDir; diff --git a/crates/uv-globfilter/src/main.rs b/crates/uv-globfilter/src/main.rs index 0f54d75ad..134d46a90 100644 --- a/crates/uv-globfilter/src/main.rs +++ b/crates/uv-globfilter/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![expect(clippy::print_stdout)] use globset::GlobSetBuilder; use std::env::args; diff --git a/crates/uv-resolver/src/lock/mod.rs b/crates/uv-resolver/src/lock/mod.rs index 836a5f0c7..69e8d474e 100644 --- a/crates/uv-resolver/src/lock/mod.rs +++ b/crates/uv-resolver/src/lock/mod.rs @@ -4076,8 +4076,7 @@ impl TryFrom for Source { type Error = LockError; fn try_from(wire: SourceWire) -> Result { - #[allow(clippy::enum_glob_use)] - use self::SourceWire::*; + use self::SourceWire::{Direct, Directory, Editable, Git, Path, Registry, Virtual}; match wire { Registry { registry } => Ok(Self::Registry(registry.into())), diff --git a/crates/uv-test/src/lib.rs b/crates/uv-test/src/lib.rs index ba0b53762..043271995 100755 --- a/crates/uv-test/src/lib.rs +++ b/crates/uv-test/src/lib.rs @@ -1852,7 +1852,6 @@ impl TestContext { } /// For when we add pypy to the test suite. - #[allow(clippy::unused_self)] pub fn python_kind(&self) -> &'static str { "python" } @@ -2171,7 +2170,7 @@ pub fn run_and_format_with_status>( // Support profiling test run commands with traces. if let Ok(root) = env::var(EnvVars::TRACING_DURATIONS_TEST_ROOT) { // We only want to fail if the variable is set at runtime. - #[allow(clippy::assertions_on_constants)] + #[expect(clippy::assertions_on_constants)] { assert!( cfg!(feature = "tracing-durations-export"), diff --git a/crates/uv-trampoline/src/bounce.rs b/crates/uv-trampoline/src/bounce.rs index 859b789b7..ff5a05b61 100644 --- a/crates/uv-trampoline/src/bounce.rs +++ b/crates/uv-trampoline/src/bounce.rs @@ -1,4 +1,3 @@ -#![allow(clippy::disallowed_types)] use std::ffi::CString; use std::path::{Path, PathBuf}; use std::vec::Vec; diff --git a/crates/uv-windows/src/spawn.rs b/crates/uv-windows/src/spawn.rs index cf524d56c..3f3915e1d 100644 --- a/crates/uv-windows/src/spawn.rs +++ b/crates/uv-windows/src/spawn.rs @@ -84,6 +84,6 @@ pub fn spawn_child(cmd: &mut Command, hide_console: bool) -> std::io::Result //! #![cfg(all(feature = "test-python", feature = "test-pypi"))] -#![allow(clippy::needless_raw_string_hashes)] -#![allow(clippy::doc_markdown)] -#![allow(clippy::doc_lazy_continuation)] +#![expect(clippy::needless_raw_string_hashes)] +#![expect(clippy::doc_markdown)] use anyhow::Result; use assert_cmd::assert::OutputAssertExt; diff --git a/crates/uv/tests/it/pip_compile.rs b/crates/uv/tests/it/pip_compile.rs index 79270e153..2f71ce1c0 100644 --- a/crates/uv/tests/it/pip_compile.rs +++ b/crates/uv/tests/it/pip_compile.rs @@ -1,4 +1,4 @@ -#![allow(clippy::disallowed_types)] +#![expect(clippy::disallowed_types)] use std::env::current_dir; use std::fs; diff --git a/crates/uv/tests/it/run.rs b/crates/uv/tests/it/run.rs index 2d6c47451..ab32aa028 100644 --- a/crates/uv/tests/it/run.rs +++ b/crates/uv/tests/it/run.rs @@ -1,4 +1,4 @@ -#![allow(clippy::disallowed_types)] +#![expect(clippy::disallowed_types)] use anyhow::Result; use assert_cmd::assert::OutputAssertExt; diff --git a/scripts/scenarios/templates/lock.mustache b/scripts/scenarios/templates/lock.mustache index e77d20210..4082b582e 100644 --- a/scripts/scenarios/templates/lock.mustache +++ b/scripts/scenarios/templates/lock.mustache @@ -4,9 +4,8 @@ //! Scenarios from <{{generated_from}}> //! #![cfg(all(feature = "test-python", feature = "test-pypi"))] -#![allow(clippy::needless_raw_string_hashes)] -#![allow(clippy::doc_markdown)] -#![allow(clippy::doc_lazy_continuation)] +#![expect(clippy::needless_raw_string_hashes)] +#![expect(clippy::doc_markdown)] use anyhow::Result; use assert_cmd::assert::OutputAssertExt;