Repository navigation
Fix the clippy warnings stable 1.97 reports on main - #224
Merged
Merged
Conversation
`cargo clippy --locked --workspace --all-targets` on current stable Rust (1.97.0, clippy 0.1.97) reports nine warnings on `main`, all in imcp2-core code that predates the toolchain's newer lints. CONTRIBUTING.md asks for a warning-free tree, so apply the minimal change each lint suggests, with no behavioural change: - `unnecessary_map_or`: `map_or(false, ..)` -> `is_some_and(..)` in tools.rs (x3) and discover.rs; `map_or(true, ..)` -> `is_none_or(..)` in calls.rs. Same truth table for `None` and `Some`. - `redundant_closure`: `.map(|h| hex::encode(h))` -> `.map(hex::encode)` in management.rs. - `cloned_ref_to_slice_refs` (test): `&[x.clone()]` -> `std::slice::from_ref(&x)` in calls.rs. - `manual_repeat_n` (tests): `repeat(..).take(n)` -> `repeat_n(.., n)` in discover.rs (x2). `cargo fmt --all` then reflowed two of the touched expressions: the `repeat_n` call in discover.rs no longer fits the 100-column budget and is split across lines, and the `module_hash` chain in management.rs now fits on one line and is joined. Nothing else changed. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01VP2vTEywKNq4z23822p8rr
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the Clippy cleanup.
No open issues 🎉
What changed in this PR
Addresses nine Clippy warnings reported by Rust 1.97 in imcp2-core using equivalent standard-library expressions, with no intended behavior changes.
Changes:
- Replaces
Option::map_orchecks withis_some_andoris_none_or. - Removes a redundant closure and an unnecessary test clone.
- Uses
repeat_nin test fixtures and applies formatting adjustments.
| File | Description |
|---|---|
crates/imcp2-core/src/tools.rs |
Simplifies optional host and URL validation checks. |
crates/imcp2-core/src/management.rs |
Passes hex::encode directly when formatting module hashes. |
crates/imcp2-core/src/discover.rs |
Simplifies header validation and repeated test data generation. |
crates/imcp2-core/src/calls.rs |
Simplifies best-match selection and avoids cloning a test entity. |
Review effort: Balanced
sea-snake
approved these changes
Oct 30, 2026
This was referenced Nov 3, 2026
aterga
added a commit
that referenced
this pull request
Nov 3, 2026
All three crates share one version. A patch bump: nothing since 0.6.0 changes the crates' public API or refuses anything 0.6.0 allowed. It carries the mcp_get_delegation retry on a lagging replica (#220), the bound on what one /oauth/authorize request stores (#221), the reworded open_app and call tool descriptions and server instructions (#226), and clippy fixes (#224). Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cargo clippy --locked --workspace --all-targetson current stable Rust (1.97.0, clippy 0.1.97) reports nine warnings onmain, all inimcp2-corecode that predates the toolchain's newer lints. CONTRIBUTING.md asks for a warning-free tree, so this applies the minimal change each lint suggests. No behavioural change: every rewrite is the lint's own suggested equivalent, and all surrounding comments are untouched.Related issues
None.
Changes
unnecessary_map_or(5):Option::map_or(false, f)→is_some_and(f)intools.rs(×3) anddiscover.rs;map_or(true, f)→is_none_or(f)incalls.rs. Same truth table forNoneandSome.redundant_closure(1):.map(|h| hex::encode(h))→.map(hex::encode)inmanagement.rs.cloned_ref_to_slice_refs(1, test):&[at_cap_entity.clone()]→std::slice::from_ref(&at_cap_entity)incalls.rs.manual_repeat_n(2, tests):std::iter::repeat(x).take(n)→std::iter::repeat_n(x, n)indiscover.rs.cargo fmt --allthen reflowed two of the touched expressions: therepeat_ncall indiscover.rsno longer fits the 100-column budget and is split across lines, and themodule_hashchain inmanagement.rsnow fits on one line and is joined.Testing
All on stable 1.97.0 (
rustc 1.97.0 (2d8144b78 2026-07-07),clippy 0.1.97,rustfmt 1.9.0-stable):cargo build --locked --all-targetscargo test --locked --all-targets— 316 tests pass, 0 failed, 0 ignored, across 5 test binaries (imcp2lib 71,imcp2bin 8,tests/routers.rs10,imcp2-core206,imcp2-local21)cargo fmt --all/cargo clippy --all-targets(tree is warning-free) —cargo clippy --locked --workspace --all-targetsnow finishes with zero warnings (nine before this change);cargo fmt --all -- --checkpasses— not applicable, the dashboard is untouchednpm test --prefix monitoring/mcp-statusClippy before (on
main, 7c9964f) and afterBefore:
After:
Checklist
Generated by Claude Code