You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
style(clippy): idiom sweep across lib/common, mylang, and checker (refs #22) (#25)
Mechanical idiom upgrades flagged by clippy. No behaviour change in
any path; all touched modules continue to test green.
checker.rs (6 sites): `if let Err(_) = X { .. }` -> `if X.is_err() { .. }`
for `define_effect`, `define_ai_model`, `define_prompt`, function
symbol define, parameter symbol define, and variable symbol define.
checker.rs:773: drop the unused `.enumerate()` whose index was already
discarded via `_i`; iterate the zipped pair directly.
lib/common/string.rs:
* `radix < 2 || radix > 36` -> `!(2..=36).contains(&radix)`
* two `std::iter::repeat(pad).take(N)` sites -> `std::iter::repeat_n(pad, N)`
(stable since Rust 1.82).
lib/common/types.rs:
* `radix < 2 || radix > 36` -> `!(2..=36).contains(&radix)`
* `assert_eq!(int_to_bool(0), false)` / `assert_eq!(.., true)` ->
`assert!(!..)` / `assert!(..)`.
lib/common/utils.rs:
* `self.next_u64() % 2 == 0` -> `self.next_u64().is_multiple_of(2)`
* two `r >= 0.0 && r < 1.0` -> `(0.0..1.0).contains(&r)`
* `r >= 5 && r <= 10` -> `(5..=10).contains(&r)`.
lib/common/array.rs:313: `slice(&vec![1,2,3,4,5], ..)` ->
`slice(&[1,2,3,4,5], ..)` (clippy::useless_vec).
lib/mylang/ai.rs:26 and lib/mylang/prompt.rs:139: keep `AiModelType::
from_str` and `PromptBuilder::add` as they are, but annotate each
with `#[allow(clippy::should_implement_trait)]` plus a one-line
rationale. Implementing `FromStr` would force callers to `.unwrap()`
an `Infallible` (the classifier never fails). Implementing
`std::ops::Add` would be wrong shape for a fluent builder (`+` ate
two operands and consumes them; `add` here chains).
Out of scope for this PR (kept clean):
* parser.rs `errors.len() > 0` x6 -- in test code that overlaps with
the depth-guard PR (#21); will land cleanly once #21 merges.
* `approx_constant` errors (PR1, #23) and the two real correctness
bugs (PR2, #24) -- handled in their own branches.
Part 3 of 4 from #22. Off clean origin/main; does not depend on PR1
(#23) or PR2 (#24).
0 commit comments