Skip to content

fix: silence clippy::map_unwrap_or in rules_overhead (unblocks Clippy CI) - #767

Closed
cedric013 wants to merge 1 commit into
yvgude:mainfrom
cedric013:fix/clippy-map-unwrap-or-rules-overhead
Closed

fix: silence clippy::map_unwrap_or in rules_overhead (unblocks Clippy CI)#767
cedric013 wants to merge 1 commit into
yvgude:mainfrom
cedric013:fix/clippy-map-unwrap-or-rules-overhead

Conversation

@cedric013

@cedric013 cedric013 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #768.

cargo clippy --all-features -- -D warnings (the Clippy job) currently fails on main:

error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
   --> rust/src/core/rules_overhead.rs:143:25
    = note: `-D clippy::map-unwrap-or` implied by `-D warnings`

Introduced by bf4ee7bf (symlink dedup, #759). This also fails the Embed SDK (lean-ctx-sdk) job, which clippy-checks the engine lib as a dependency.

Fix: use map_or_else (clippy's own suggestion). Behaviour is unchanged — canonicalize the path to a string, else fall back to the original f.path.

let canonical = std::fs::canonicalize(&f.path)
    .map_or_else(|_| f.path.clone(), |p| p.to_string_lossy().to_string());

Test plan

  • cargo clippy --all-features -- -D warnings -> passes (no errors)
  • cargo fmt --check

Notes for reviewers

  • Risk areas / edge cases: none — pure lint fix, identical control flow (Ok -> stringified path, Err -> original path).
  • Backwards compatibility: unaffected.

cargo clippy --all-features -- -D warnings failed on rules_overhead.rs:143 (map(..).unwrap_or_else(..) on a Result). Use map_or_else, which clippy's own suggestion recommends. Behaviour unchanged: canonicalize the path, else fall back to the original. Fixes the red Clippy / Embed SDK jobs on main.
@yvgude

yvgude commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Closing — the identical rules_overhead.rs Clippy fix already landed via PR #765 (commit f32c558). #768 is resolved.

@yvgude yvgude closed this Jul 9, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Clippy CI red on main — clippy::map_unwrap_or in rules_overhead.rs:143

2 participants