Skip to content

fix: add workspace clippy lint enforcement and fix all violations - #232

Merged
adityamukho merged 15 commits into
mainfrom
fix/clippy-lint-enforcement
May 8, 2026
Merged

adityamukho merged 15 commits into
mainfrom
fix/clippy-lint-enforcement

Conversation

@adityamukho

Copy link
Copy Markdown
Collaborator

Summary

  • Add production-grade clippy lints to [workspace.lints.clippy] in root Cargo.toml with deny-level enforcement for: unwrap_used, expect_used, panic, todo, unimplemented, cast_possible_truncation, cast_possible_wrap, cast_sign_loss, indexing_slicing
  • All 4 workspace members opt in via [lints] workspace = true
  • Test code exempted via #![cfg_attr(test, allow(...))] at each crate root
  • Fix all ~336 existing violations across ~20 source files:
    • Panic prevention: unwrap()/expect() → ? / .map_err() / .ok_or_else(); panic!() → return Err()
    • Numeric safety: as i64 / as u32 → .cast_signed() / try_from()
    • Bounds safety: direct indexing → .get().ok_or_else() or #[allow] with invariant comment
    • Lock poison: .lock().unwrap() → .lock().map_err(|_| anyhow!("lock poisoned"))?
    • FFI (minigraf-c): unwrap() → match with error-setting fallback (can't use ? in extern "C")
  • Zero clippy errors, 829 tests passing

Test plan

  • cargo clippy --lib produces zero errors
  • cargo clippy --lib produces zero warnings
  • cargo test --workspace passes (829 tests, 0 failures)
  • cargo fmt --check passes
  • Pre-push hook (fmt + clippy + test) passes
  • CI passes on GitHub

🤖 Generated with Claude Code

adityamukho and others added 15 commits May 3, 2026 14:58
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace unwrap/expect on RwLock guards with unwrap_or_else(poison
recovery) in non-Result fns and map_err(?)  in Result-returning fns.
Fix indexing_slicing in write_header via get_mut().ok_or_else(), and
arithmetic_side_effects in FileBackend via checked_mul/checked_add.
Replace order.len()-1 subtraction in touch() with back()==Some(&id).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…acts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…atcher, functions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…poral, repl, and FFI

Fix all remaining deny-level clippy lint violations across:
- query/datalog/evaluator.rs: RwLock expect→map_err, indexing→.get()/.first()
- query/datalog/executor.rs: panic→Err, unwrap→map_err, indexing with allow
- query/datalog/parser.rs: indexing→.get() with String errors
- query/datalog/optimizer.rs, rules.rs, stratification.rs: unwrap→ok_or_else
- db.rs: expect→map_err, cast u64→i64 via .cast_signed()
- wal.rs: cast truncation via try_from, unwrap→ok_or_else
- temporal.rs: unwrap→ok_or_else
- repl.rs: unwrap→if-let patterns
- minigraf-c/src/lib.rs: unwrap→match for FFI lock handling

Zero clippy errors remain. 829 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
arithmetic_side_effects, unreachable, and missing_errors_doc are too
noisy for production code (parser index arithmetic, exhaustive match
arms, every Result-returning fn). Set to allow since the pre-push hook
uses -D warnings which would escalate them to deny anyway.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

@adityamukho
adityamukho merged commit 47abeaf into main May 8, 2026
36 checks passed
@adityamukho
adityamukho deleted the fix/clippy-lint-enforcement branch May 8, 2026 12:46
@adityamukho adityamukho mentioned this pull request May 17, 2026
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant