From 370771b28c0ef61afdf07c41f05af9bacf82995d Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 21 Oct 2023 23:54:13 -0400 Subject: [PATCH] Make `clean` non-async (#163) --- crates/puffin-cli/src/commands/clean.rs | 6 ++---- crates/puffin-cli/src/main.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/puffin-cli/src/commands/clean.rs b/crates/puffin-cli/src/commands/clean.rs index 6e21d5ab8..d608424aa 100644 --- a/crates/puffin-cli/src/commands/clean.rs +++ b/crates/puffin-cli/src/commands/clean.rs @@ -2,14 +2,14 @@ use std::fmt::Write; use std::path::Path; use anyhow::{Context, Result}; -use fs_err::tokio as fs; +use fs_err as fs; use tracing::debug; use crate::commands::ExitStatus; use crate::printer::Printer; /// Clear the cache. -pub(crate) async fn clean(cache: Option<&Path>, mut printer: Printer) -> Result { +pub(crate) fn clean(cache: Option<&Path>, mut printer: Printer) -> Result { let Some(cache) = cache else { return Err(anyhow::anyhow!("No cache found")); }; @@ -33,11 +33,9 @@ pub(crate) async fn clean(cache: Option<&Path>, mut printer: Printer) -> Result< { if entry.file_type()?.is_dir() { fs::remove_dir_all(entry.path()) - .await .with_context(|| format!("Failed to clear cache at {}", cache.display()))?; } else { fs::remove_file(entry.path()) - .await .with_context(|| format!("Failed to clear cache at {}", cache.display()))?; } } diff --git a/crates/puffin-cli/src/main.rs b/crates/puffin-cli/src/main.rs index 366dcc066..556f60c59 100644 --- a/crates/puffin-cli/src/main.rs +++ b/crates/puffin-cli/src/main.rs @@ -185,7 +185,7 @@ async fn main() -> ExitCode { .collect::>(); commands::pip_uninstall(&sources, cache_dir, printer).await } - Commands::Clean => commands::clean(cache_dir, printer).await, + Commands::Clean => commands::clean(cache_dir, printer), Commands::Freeze => commands::freeze(cache_dir, printer), Commands::Venv(args) => commands::venv(&args.name, args.python.as_deref(), printer).await, Commands::Add(args) => commands::add(&args.name, printer),