From bea71d88f1e67415e8e3883664cb9e0140f7088d Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 17 Dec 2025 21:47:31 +0000 Subject: [PATCH] fix: resolve clippy warnings and add stricter CI check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add `cargo clippy -- -D warnings` to CI (without --all-features) - Fix unstable_name_collisions in path.rs using explicit trait syntax - Fix unnecessary_unwrap warnings in tasks/add.rs using if-let - Fix unnecessary_unwrap warning in lockfile.rs using if-let - Remove unused import in cmd.rs test module 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .github/workflows/test.yml | 1 + src/cli/tasks/add.rs | 16 ++++++++-------- src/cmd.rs | 2 +- src/lockfile.rs | 3 +-- src/path.rs | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d68831402..6dd7178b92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -145,6 +145,7 @@ jobs: - run: cargo machete --with-metadata - run: ./scripts/test-standalone.sh - run: mise run lint + - run: cargo clippy -- -D warnings - run: cargo clippy --all-features --all-targets -- -D warnings nightly: diff --git a/src/cli/tasks/add.rs b/src/cli/tasks/add.rs index e78652a6c4..0c8590c9f6 100644 --- a/src/cli/tasks/add.rs +++ b/src/cli/tasks/add.rs @@ -100,8 +100,8 @@ impl TasksAdd { if let Some(description) = &self.description { lines.push("#MISE description=\"".to_string() + description + "\""); } - if self.dir.is_some() { - lines.push("#MISE dir=".to_string() + &self.dir.unwrap()); + if let Some(dir) = &self.dir { + lines.push("#MISE dir=".to_string() + dir); } if self.hide { lines.push("#MISE hide=true".to_string()); @@ -165,8 +165,8 @@ impl TasksAdd { } task.insert("wait_for", Item::Value(wait_for.into())); } - if self.description.is_some() { - task.insert("description", self.description.unwrap().into()); + if let Some(description) = &self.description { + task.insert("description", description.clone().into()); } if !self.alias.is_empty() { let mut alias = toml_edit::Array::new(); @@ -175,8 +175,8 @@ impl TasksAdd { } task.insert("alias", Item::Value(alias.into())); } - if self.dir.is_some() { - task.insert("dir", self.dir.unwrap().into()); + if let Some(dir) = &self.dir { + task.insert("dir", dir.clone().into()); } if self.hide { task.insert("hide", true.into()); @@ -198,8 +198,8 @@ impl TasksAdd { } task.insert("outputs", Item::Value(outputs.into())); } - if self.shell.is_some() { - task.insert("shell", self.shell.unwrap().into()); + if let Some(shell) = &self.shell { + task.insert("shell", shell.clone().into()); } if self.quiet { task.insert("quiet", true.into()); diff --git a/src/cmd.rs b/src/cmd.rs index 9c5363ac21..fe56d9b2ea 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -529,7 +529,7 @@ enum ChildProcessOutput { mod tests { use pretty_assertions::assert_eq; - use crate::{cmd, config::Config}; + use crate::config::Config; #[tokio::test] async fn test_cmd() { diff --git a/src/lockfile.rs b/src/lockfile.rs index 1560c2779f..30f652d93a 100644 --- a/src/lockfile.rs +++ b/src/lockfile.rs @@ -487,10 +487,9 @@ fn merge_tool_entries_with_env( entry.1.insert(e.clone()); } } - } else if existing_tool.env.is_some() { + } else if let Some(existing_envs) = &existing_tool.env { // Check if this env is already covered by a new entry // If so, the existing entry is stale and should not be preserved - let existing_envs = existing_tool.env.as_ref().unwrap(); let env_already_covered = by_key .values() .any(|(_, new_envs, _)| existing_envs.iter().any(|e| new_envs.contains(e))); diff --git a/src/path.rs b/src/path.rs index 3f188c60ec..b1f2763943 100644 --- a/src/path.rs +++ b/src/path.rs @@ -20,7 +20,7 @@ impl PathExt for Path { } fn mount(&self, on: &Path) -> PathBuf { - if self.is_empty() { + if PathExt::is_empty(self) { on.to_path_buf() } else { on.join(self)