Repository navigation
Description
While running cargo clippy -p my-lang --lib --tests --no-deps (during the depth-guard review in #21) the lint pass surfaces 5 errors (clippy::approx_constant, denied-by-default) and ~26 warnings in lib/common/* and a couple in src/. None of them are caused by recent work; they have been latent. Filing for separate cleanup so the parser PR stays scoped.
Errors (clippy::approx_constant -- deny-by-default)
Hardcoded approximations of pi in test asserts; clippy wants std::f64::consts::PI instead.
crates/my-lang/lib/common/math.rs:268--(abs_float(-3.14) - 3.14).abs() < f64::EPSILON(two occurrences)crates/my-lang/lib/common/string.rs:300crates/my-lang/lib/common/types.rs:297crates/my-lang/lib/common/types.rs:304
Fix per site: replace the literal 3.14 with std::f64::consts::PI (or move to a const PI_APPROX: f64 = ...; if rounding to two decimals is intentional, and #[allow] that one site with a comment explaining why).
Warnings worth a clippy --fix sweep
Most are auto-fixable via cargo clippy --fix -p my-lang --lib --tests -- --no-deps. Grouped by category:
Redundant patterns (checker.rs): lines 419, 448, 472, 509, 544, 613 use if let Err(_) = ... where .is_err() is preferred.
length comparison to zero in parser error-recovery tests: errors.len() > 0 at parser.rs lines 2568, 2590, 2610, 2638, 2660, 2683 -- prefer !errors.is_empty().
lib/common/* style nits:
io.rs:41,44--filter_mapon anErr-producing iterator (potential infinite loop).string.rs:138,148--repeat().take()should be the dedicated method.string.rs:200,types.rs:94-- manualRangeInclusive::contains.string.rs:209,types.rs:103--as u64oni64::abs()result (useunsigned_abs).utils.rs:98-- manualis_multiple_of.utils.rs:297,298,305-- manualRange::contains/RangeInclusive::contains.array.rs:313--&vec![...]where&[...]works.types.rs:321,322--assert_eq!(x, true/false)->assert!(...).mylang/ai.rs:26andmylang/prompt.rs:139-- method namesfrom_str/addshadow std trait methods.
Dead-code warnings (independent of the lint sweep):
parser.rs:825--parse_comptime_declis unused.interpreter.rs:180-- a manualimplthat could be#[derive]d.checker.rs:773--.enumerate()with the index discarded.my-pkg/src/lib.rs-- 3 unused vars (148, 176, 314) and 1 unused field (134).my-mir/src/lib.rs:1019-- unusedFrame::functionfield.my-ai/src/lib.rs:425-- unusedCachedResponse::timestampfield.
Suggested approach
- One PR for the 5
approx_constanterrors (smallest, unblockscargo clippy -- -D warningsin CI if/when that flips on). - One PR running
cargo clippy --fixacross the auto-fixable warnings, with the un-fixable ones (from_str/addtrait shadowing, thefilter_mapinfinite-loop risk, the dead-code items) handled by hand.
Activity
fix(lint): replace `3.14` test literals with `2.5` to clear clippy::a…
fix(lib/common): two latent correctness bugs in stdin/radix paths (refs
style(clippy): idiom sweep across lib/common, mylang, and checker (refs
refactor: wire up dead fields, derive Default, clarify package-mgr st…
hyperpolymath commentedon May 15, 2026
All four severity-ordered PRs have landed:
parse_comptime_declmethod from parser #28 -- the deferred follow-up removing deadparse_comptime_decl(the one item PR4 held back to avoid feat(parser): add MAX_PARSE_EXPR_DEPTH guard + recover partial AST (closes #15) #21 overlap)Closing.
chore: remove dead `parse_comptime_decl` method from parser (#28)