From d58915e8b38dc9cd7f4c4b2d5bc7e4976db661be Mon Sep 17 00:00:00 2001 From: Mitchell Berendhuysen <45570310+MitchellBerend@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:30:33 +0100 Subject: [PATCH] Replace `remove_dir_all` with `remove_virtualenv` (#16203) ## Summary Replace `remove_dir_all` with `remove_virtualenv` for the tool environment creation code path. Closes #14985 ## Test Plan Relied on existing test coverage. --------- Co-authored-by: Tomasz Kramkowski --- crates/uv-tool/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/uv-tool/src/lib.rs b/crates/uv-tool/src/lib.rs index b649fbad2..dd7a5eb39 100644 --- a/crates/uv-tool/src/lib.rs +++ b/crates/uv-tool/src/lib.rs @@ -314,14 +314,14 @@ impl InstalledTools { let environment_path = self.tool_dir(name); // Remove any existing environment. - match fs_err::remove_dir_all(&environment_path) { + match remove_virtualenv(&environment_path) { Ok(()) => { debug!( "Removed existing environment for tool `{name}`: {}", environment_path.user_display() ); } - Err(err) if err.kind() == io::ErrorKind::NotFound => (), + Err(uv_virtualenv::Error::Io(err)) if err.kind() == io::ErrorKind::NotFound => (), Err(err) => return Err(err.into()), }