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
-**Conventional single-letter names:**`n` for a natural number (unsigned integer or count);`f` for a `fmt::Formatter`; and similar well-established conventions from math or the Rust standard library. Note: for indices, use `index`, `idx`, or `*_index` such as `row_index`, not `n`. For `i`/`j`/`k`, see the dedicated rule below.
108
+
-**Conventional single-letter names:**`n` for a natural number such as an unsigned integer or count,`f` for a `fmt::Formatter`, and similar well-established conventions from math or the Rust standard library. Note: for indices, use `index`, `idx`, or `*_index` such as `row_index`, not `n`. For `i`/`j`/`k`, see the dedicated rule below.
-**Index variables (`i`, `j`, `k`):** These may only be used in two contexts: short closures and index-based loops or iterations (rare in Rust). In all other cases, use `index`, `idx`, or `*_index`.
115
+
-**Index variables (`i`, `j`, `k`):** These may only be used in two contexts: short closures, and index-based loops or iterations. The latter is rare in Rust. In all other cases, use `index`, `idx`, or `*_index`.
116
116
117
117
```rust
118
118
// OK: short closure
@@ -147,7 +147,7 @@ Use **descriptive names** for variables and closure parameters by default. Singl
147
147
148
148
#### When single-letter names are NOT allowed
149
149
150
-
-**Multi-line functions and closures:**When a function or closure body spans multiple lines, such as a body that contains a `let` binding followed by another expression, or multiple chained operations, use a descriptive name.
150
+
-**Multi-line functions and closures:**Use a descriptive name when a function or closure body spans multiple lines. Examples include a body that contains a `let` binding followed by another expression, or a body with multiple chained operations.
151
151
152
152
```rust
153
153
// Good
@@ -172,7 +172,7 @@ Use **descriptive names** for variables and closure parameters by default. Singl
172
172
letm=entry.metadata()?;
173
173
```
174
174
175
-
-**Function and method parameters:** Always use descriptive names, except for conventional single-letter names listed above (`n`, `f`, etc.).
175
+
-**Function and method parameters:** Always use descriptive names, except for the conventional single-letter names listed above, such as `n` and `f`.
176
176
177
177
-**Closures with non-obvious context:** When the type or purpose is not immediately clear from the surrounding method chain, use a descriptive name.
178
178
@@ -206,7 +206,7 @@ where
206
206
-`Display`: derive when the type needs to be displayed, such as when it is printed to stderr or used in format strings.
207
207
-`Error`: derive when the type is used as a `std::error::Error`, such as the error type in `Result` or the source of another error. Not all types with `Display` need `Error`.
208
208
- A type that only needs formatting and not error handling should derive `Display` without `Error`.
209
-
- Minimize `unwrap()` in non-test code; use proper error propagation. `unwrap()` is acceptable in tests and for provably infallible operations, with a comment explaining why. When deliberately ignoring an error, use `.ok()` with a comment explaining why.
209
+
- Minimize `unwrap()` in non-test code; use proper error propagation. `unwrap()` is acceptable in tests, and is also acceptable for provably infallible operations when accompanied by a comment explaining why. When deliberately ignoring an error, use `.ok()` with a comment explaining why.
> Always run the full test suite before committing, even for seemingly trivial changes such as documentation edits, comment changes, or config updates. Any change can break formatting, linting, building, tests, or doc generation across the different feature combinations.
384
+
> Always run the full test suite before every commit. This rule applies to all changes, including documentation edits, comment changes, and config updates. Any change can break formatting, linting, building, tests, or doc generation across the different feature combinations.
385
385
386
386
> [!NOTE]
387
387
> Some tests may fail with a hint about `TEST_SKIP`. Follow the hint and rerun with the suggested variable.
0 commit comments