all: bump {cargo,flake} deps, fix clippy lints#619
Conversation
WalkthroughWorkspace Clippy config and a dependency update were applied; several small refactors replaced conditional branching with functional patterns, test modules gained explicit Clippy expect annotations, and minor formatting/lazy-evaluation tweaks were made across multiple crates. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cdd0a11 to
291480a
Compare
291480a to
afcac1f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Cargo.toml (1)
85-85: Replace the workspace-wide Clippy allow with local annotations on specific structs.The workspace-wide
struct_excessive_boolsallow at line 85 suppresses this lint across all crates. However, only four structs actually have ≥4 bool fields:
NixBuildPassthroughArgs(20 bool fields) in crates/nh-core/src/args.rs:50CleanArgs(5 bool fields) in crates/nh-clean/src/args.rs:24OsRebuildArgs(4 bool fields) in crates/nh-nixos/src/args.rs:143OsRollbackArgs(4 bool fields) in crates/nh-nixos/src/args.rs:216Use targeted
#[allow(clippy::struct_excessive_bools)]on these structs instead to preserve lint signal elsewhere.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Cargo.toml` at line 85, The workspace-wide clippy allow `struct_excessive_bools` should be removed from Cargo.toml and replaced with targeted annotations: add `#[allow(clippy::struct_excessive_bools)]` directly above the struct definitions for NixBuildPassthroughArgs, CleanArgs, OsRebuildArgs, and OsRollbackArgs so the lint is only suppressed for those four structs while restoring the lint elsewhere.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Cargo.toml`:
- Line 28: Update the clap_mangen dependency declaration to enable the env
feature so environment-backed arguments are supported: change the clap_mangen
entry in Cargo.toml to include features = ["env"] (keeping version "0.3.0");
this ensures the Main command usage of env = "NH_ELEVATION_STRATEGY" in the
interface.rs code and the man page generation in xtask/src/man.rs will correctly
handle environment variables when producing the man pages.
---
Nitpick comments:
In `@Cargo.toml`:
- Line 85: The workspace-wide clippy allow `struct_excessive_bools` should be
removed from Cargo.toml and replaced with targeted annotations: add
`#[allow(clippy::struct_excessive_bools)]` directly above the struct definitions
for NixBuildPassthroughArgs, CleanArgs, OsRebuildArgs, and OsRollbackArgs so the
lint is only suppressed for those four structs while restoring the lint
elsewhere.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7acb2157-0d33-4359-bef7-c9bab5931d0a
📒 Files selected for processing (8)
Cargo.tomlcrates/nh-core/src/checks.rscrates/nh-core/src/command.rscrates/nh-core/src/installable.rscrates/nh-core/src/util.rscrates/nh-home/src/home.rscrates/nh-nixos/src/args.rscrates/nh-nixos/src/generations.rs
💤 Files with no reviewable changes (1)
- crates/nh-nixos/src/args.rs
✅ Files skipped from review due to trivial changes (4)
- crates/nh-core/src/util.rs
- crates/nh-home/src/home.rs
- crates/nh-core/src/command.rs
- crates/nh-nixos/src/generations.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/nh-core/src/checks.rs
| clap_complete = "4.5.61" | ||
| clap_complete_nushell = "4.5.10" | ||
| clap_mangen = "0.2.31" | ||
| clap_mangen = "0.3.0" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Resolved clap_mangen version in Cargo.lock =="
if [[ -f Cargo.lock ]]; then
awk '
$0 ~ /^name = "clap_mangen"$/ {print FNR ":" $0; in_pkg=1; next}
in_pkg && $0 ~ /^version = / {print FNR ":" $0; in_pkg=0}
' Cargo.lock
else
echo "Cargo.lock not found"
fi
echo
echo "== clap_mangen usage sites in Rust code =="
rg -n --type rust -C3 '\bclap_mangen\b|Man::new\s*\(|generate_to\s*\('Repository: nix-community/nh
Length of output: 2501
🌐 Web query:
clap_mangen 0.3.0 release notes changelog breaking changes API
💡 Result:
clap_mangen 0.3.0 was released on 2026-03-27 as part of the clap-rs/clap monorepo. Release notes and changelog: Available in clap_mangen/CHANGELOG.md at https://github.com/clap-rs/clap/tree/master/clap_mangen. From the release commit (f0d30d9), the [0.3.0] section lists: ## [0.3.0] - 2026-03-27 ### Compatibility - env feature is now required for environment variable support This appears to be the primary change, listed under "Compatibility," indicating a breaking change for users relying on environment variable support without explicitly enabling the env feature. No other added features, fixes, or breaking API changes are mentioned in the visible diff for this release. Previous versions (e.g., 0.2.33) had changes like MSRV updates, but 0.3.0 specifically highlights the env feature requirement. API documentation: https://docs.rs/clap_mangen/0.3.0/clap_mangen/ Public API includes: - clap_mangen::Man::new(cmd: clap::Command) -> Man - Man::render(&self, writer: &mut impl roff::RoffWrite) -> Result<, roff::Error> - generate_to(path: impl AsRef, cmd: &clap::Command) -> Result<, Error> No explicit breaking API changes noted beyond the feature flag requirement. The crate depends on clap ^4.0.0 and roff ^1.0.0, with MSRV 1.85.
Citations:
- 1: https://crates.io/crates/clap-mangen/0.3.0
- 2: https://github.com/clap-rs/clap/blob/master/CHANGELOG.md
- 3: clap-rs/clap@f0d30d9
- 4: https://crates.io/crates/clap_mangen
- 5: https://docs.rs/clap_mangen/=0.3.0/
- 6: https://github.com/clap-rs/clap/tree/master/clap_mangen
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Checking clap_mangen feature configuration in Cargo.toml =="
rg -A5 -B5 'clap_mangen.*=' Cargo.toml
echo
echo "== Searching for env variable usage in command definition =="
# Search for env-backed arguments in the Main command definition
fd -t rs -path '*/interface/*' | head -20 | while read f; do
if rg -l 'enum Main|struct Main|fn command' "$f" 2>/dev/null; then
echo "File: $f"
rg -n 'env\(|env_var|\.env\(' "$f" -C2
fi
done
echo
echo "== Searching broadly for .env() calls in Rust code =="
rg -n '\.env\(' --type rustRepository: nix-community/nh
Length of output: 949
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Finding interface directory and Main definition =="
find . -name "*.rs" -path "*/interface*" | head -20
echo
echo "== Searching for Main command definition =="
rg -n 'fn command\(\)' --type rust
echo
echo "== Searching for env() calls on command setup =="
rg -n '\.env\(' --type rust | head -30Repository: nix-community/nh
Length of output: 187
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Reading interface.rs to find Main definition and command() =="
wc -l ./crates/nh/src/interface.rs
echo
cat -n ./crates/nh/src/interface.rs | head -150
echo
echo "== Searching for env() method calls in the file =="
rg -n '\.env\(' ./crates/nh/src/interface.rsRepository: nix-community/nh
Length of output: 3579
Enable env feature for clap_mangen 0.3.0.
Line 28 updates to 0.3.0, which requires the env feature for environment variable support. The Main command at crates/nh/src/interface.rs:46 uses env = "NH_ELEVATION_STRATEGY", so clap_mangen must be updated to:
clap_mangen = { version = "0.3.0", features = ["env"] }
Without this, the man page generation in xtask/src/man.rs:18 may not properly handle environment-backed arguments.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Cargo.toml` at line 28, Update the clap_mangen dependency declaration to
enable the env feature so environment-backed arguments are supported: change the
clap_mangen entry in Cargo.toml to include features = ["env"] (keeping version
"0.3.0"); this ensures the Main command usage of env = "NH_ELEVATION_STRATEGY"
in the interface.rs code and the man page generation in xtask/src/man.rs will
correctly handle environment variables when producing the man pages.
Sanity Checking
nix fmtto format my Nix codecargo fmtto format my Rust codecargo clippyand fixed any new linter warnings.logic
description.
x86_64-linuxaarch64-linuxx86_64-darwinaarch64-darwinAdd a 👍 reaction to pull requests you find important.
Summary by CodeRabbit
Refactor
Chores