From 71a759605a5ea2b68093cf19f1f3fc8bfe3c15b8 Mon Sep 17 00:00:00 2001 From: Chawye Hsu Date: Mon, 22 Jul 2024 21:16:34 +0800 Subject: [PATCH] fix: cargo clippy fix Signed-off-by: Chawye Hsu --- crates/libscoop/src/config.rs | 2 +- crates/libscoop/src/internal/dag.rs | 4 ++-- crates/libscoop/src/package/download.rs | 2 +- src/cui.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/libscoop/src/config.rs b/crates/libscoop/src/config.rs index 598ea2a..011210f 100644 --- a/crates/libscoop/src/config.rs +++ b/crates/libscoop/src/config.rs @@ -225,7 +225,7 @@ impl FromStr for IsolatedPath { // `=` is not a valid character in environment variable names // ref: https://learn.microsoft.com/en-us/windows/win32/procthread/environment-variables - if s.contains("=") { + if s.contains('=') { return Err(Error::ConfigValueInvalid(s)); } diff --git a/crates/libscoop/src/internal/dag.rs b/crates/libscoop/src/internal/dag.rs index 4b2dadb..48f7d3c 100644 --- a/crates/libscoop/src/internal/dag.rs +++ b/crates/libscoop/src/internal/dag.rs @@ -148,8 +148,8 @@ where .map(|(node, _)| node) .next() .cloned(); - if node.is_some() { - Self::__unregister(&mut self.nodes, node.as_ref().unwrap()); + if let Some(node) = &node { + Self::__unregister(&mut self.nodes, node); } node } diff --git a/crates/libscoop/src/package/download.rs b/crates/libscoop/src/package/download.rs index 2bc9393..a88af03 100644 --- a/crates/libscoop/src/package/download.rs +++ b/crates/libscoop/src/package/download.rs @@ -430,7 +430,7 @@ impl<'a> PackageSet<'a> { } } -fn set_cookie(easy: &mut Easy, cookie: &Vec<(&str, &str)>) -> Fallible<()> { +fn set_cookie(easy: &mut Easy, cookie: &[(&str, &str)]) -> Fallible<()> { if !cookie.is_empty() { let mut header_cookie = String::from("Cookie: "); header_cookie.push_str( diff --git a/src/cui.rs b/src/cui.rs index ad0f92a..75659ed 100644 --- a/src/cui.rs +++ b/src/cui.rs @@ -136,7 +136,7 @@ impl BucketUpdateUI { .unwrap() .execute(Print(format!("{} {}\n", name, "Ok".green()))) .unwrap(), - BucketState::Failed(_) => stdout + BucketState::Failed(_err) => stdout .execute(Clear(ClearType::CurrentLine)) .unwrap() .execute(Print(format!("{} {}\n", name, "Err".red())))