diff --git a/clippy.toml b/clippy.toml index 949a93200..82c596a41 100644 --- a/clippy.toml +++ b/clippy.toml @@ -17,6 +17,11 @@ disallowed-types = [ "std::fs::File", "std::fs::OpenOptions", "std::fs::ReadDir", + "tokio::fs::DirBuilder", + "tokio::fs::DirEntry", + "tokio::fs::File", + "tokio::fs::OpenOptions", + "tokio::fs::ReadDir", ] disallowed-methods = [ @@ -38,7 +43,28 @@ disallowed-methods = [ "std::fs::soft_link", "std::fs::symlink_metadata", "std::fs::write", + "tokio::fs::canonicalize", + "tokio::fs::copy", + "tokio::fs::create_dir", + "tokio::fs::create_dir_all", + "tokio::fs::hard_link", + "tokio::fs::metadata", + "tokio::fs::read", + "tokio::fs::read_dir", + "tokio::fs::read_link", + "tokio::fs::read_to_string", + "tokio::fs::remove_dir", + "tokio::fs::remove_dir_all", + "tokio::fs::remove_file", + "tokio::fs::rename", + "tokio::fs::set_permissions", + "tokio::fs::symlink_metadata", + "tokio::fs::try_exists", + "tokio::fs::write", { path = "std::os::unix::fs::symlink", allow-invalid = true }, { path = "std::os::windows::fs::symlink_dir", allow-invalid = true }, { path = "std::os::windows::fs::symlink_file", allow-invalid = true }, + { path = "tokio::fs::symlink", allow-invalid = true }, + { path = "tokio::fs::symlink_dir", allow-invalid = true }, + { path = "tokio::fs::symlink_file", allow-invalid = true }, ] diff --git a/crates/uv-distribution/src/distribution_database.rs b/crates/uv-distribution/src/distribution_database.rs index 247112666..2700fb2d6 100644 --- a/crates/uv-distribution/src/distribution_database.rs +++ b/crates/uv-distribution/src/distribution_database.rs @@ -733,7 +733,10 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> { // Download the wheel to a temporary file. let temp_file = tempfile::tempfile_in(self.build_context.cache().root()) .map_err(Error::CacheWrite)?; - let mut writer = tokio::io::BufWriter::new(tokio::fs::File::from_std(temp_file)); + let mut writer = tokio::io::BufWriter::new(fs_err::tokio::File::from_std( + // It's an unnamed file on Linux so that's the best approximation. + fs_err::File::from_parts(temp_file, self.build_context.cache().root()), + )); match progress { Some((reporter, progress)) => { diff --git a/crates/uv/tests/it/common/mod.rs b/crates/uv/tests/it/common/mod.rs index 5737aae4f..64b6d1e5e 100644 --- a/crates/uv/tests/it/common/mod.rs +++ b/crates/uv/tests/it/common/mod.rs @@ -1799,7 +1799,7 @@ pub async fn download_to_disk(url: &str, path: &Path) { .await .unwrap(); - let mut file = tokio::fs::File::create(path).await.unwrap(); + let mut file = fs_err::tokio::File::create(path).await.unwrap(); let mut stream = response.bytes_stream(); while let Some(chunk) = stream.next().await { file.write_all(&chunk.unwrap()).await.unwrap();