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
-**NO COMMENTS**: Never add comments to code (`//`, `/* */`, `///`, `//!`, `#`, etc.). Code must be self-explanatory through naming, types, and structure. This applies to all languages (TypeScript, Rust, JavaScript, etc.).
24
24
25
+
## Rust Clippy Rules (Workspace Lints)
26
+
All Rust code must respect these workspace-level lints defined in `Cargo.toml`:
27
+
28
+
**Rust compiler lints:**
29
+
-`unused_must_use = "deny"` — Always handle `Result`/`Option` or types marked `#[must_use]`; never ignore them.
30
+
31
+
**Clippy lints (all denied):**
32
+
-`dbg_macro` — Never use `dbg!()` in code; use proper logging instead.
33
+
-`let_underscore_future` — Never write `let _ = async_fn()` which silently drops futures; await or explicitly handle them.
34
+
-`unchecked_duration_subtraction` — Use `saturating_sub` instead of `-` for `Duration` to avoid panics.
35
+
-`collapsible_if` — Merge nested `if` statements: use `if a && b { }` instead of `if a { if b { } }`.
36
+
-`clone_on_copy` — Don't call `.clone()` on `Copy` types; just copy them directly.
37
+
-`redundant_closure` — Use function references directly: `iter.map(foo)` instead of `iter.map(|x| foo(x))`.
38
+
-`ptr_arg` — Accept `&[T]` or `&str` instead of `&Vec<T>` or `&String` in function parameters.
39
+
-`len_zero` — Use `.is_empty()` instead of `.len() == 0` or `.len() > 0`.
40
+
-`let_unit_value` — Don't assign `()` to a variable: write `foo();` instead of `let _ = foo();` when return is unit.
41
+
-`unnecessary_lazy_evaluations` — Use `.unwrap_or(val)` instead of `.unwrap_or_else(|| val)` for cheap values.
42
+
-`needless_range_loop` — Use `for item in &collection` instead of `for i in 0..collection.len()` when index isn't needed.
43
+
-`manual_clamp` — Use `.clamp(min, max)` instead of manual `if` chains or `.min().max()` patterns.
44
+
25
45
## Testing
26
46
- TS/JS: Vitest where present (e.g., desktop). Name tests `*.test.ts(x)` near sources.
27
47
- Rust: `cargo test` per crate; tests in `src` or `tests`.
0 commit comments