From b71b2862c9073ab581db3448f7481b3527b9da69 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 12 Feb 2026 23:22:26 +0300 Subject: [PATCH] infra: add clippy allows; fix `PathBuf` -> `Path` Signed-off-by: NotAShelf Change-Id: I07795374f678fa2ec17b4171fa7e32276a6a6964 --- src/git/mod.rs | 12 +++++------- src/main.rs | 6 ++++++ src/rate_limiter.rs | 14 +++++++------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/git/mod.rs b/src/git/mod.rs index f2b93a9..70ebded 100644 --- a/src/git/mod.rs +++ b/src/git/mod.rs @@ -288,10 +288,9 @@ pub fn detect_vcs_type>(path: P) -> VcsType { .args(["root"]) .current_dir(path) .output() + && output.status.success() { - if output.status.success() { - return VcsType::Jujutsu; - } + return VcsType::Jujutsu; } // Check for git @@ -299,10 +298,9 @@ pub fn detect_vcs_type>(path: P) -> VcsType { .args(["rev-parse", "--show-toplevel"]) .current_dir(path) .output() + && output.status.success() { - if output.status.success() { - return VcsType::Git; - } + return VcsType::Git; } VcsType::None @@ -333,7 +331,7 @@ pub fn repo_has_uncommitted_changes>(path: P) -> Result { .current_dir(path) .output() .map_err(|e| { - PakkerError::GitError(format!("Failed to run jj status: {}", e)) + PakkerError::GitError(format!("Failed to run jj status: {e}")) })?; let output_str = String::from_utf8_lossy(&output.stdout); diff --git a/src/main.rs b/src/main.rs index eee865b..3fdbf3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,9 @@ +// Allow pre-existing clippy warnings for functions with many arguments +// and complex types that would require significant refactoring +#![allow(clippy::too_many_arguments)] +#![allow(clippy::type_complexity)] +#![allow(clippy::large_enum_variant)] + mod cli; mod error; mod export; diff --git a/src/rate_limiter.rs b/src/rate_limiter.rs index dc5b97e..72dde8d 100644 --- a/src/rate_limiter.rs +++ b/src/rate_limiter.rs @@ -80,13 +80,13 @@ impl RateLimiter { platform_requests .retain(|t| now.duration_since(*t) < Duration::from_secs(60)); - if platform_requests.len() >= burst as usize { - if let Some(oldest) = platform_requests.first() { - let wait_time = interval.saturating_sub(now.duration_since(*oldest)); - if wait_time > Duration::ZERO { - drop(inner); - tokio::time::sleep(wait_time).await; - } + if platform_requests.len() >= burst as usize + && let Some(oldest) = platform_requests.first() + { + let wait_time = interval.saturating_sub(now.duration_since(*oldest)); + if wait_time > Duration::ZERO { + drop(inner); + tokio::time::sleep(wait_time).await; } }