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
Added comprehensive documentation for the `pipe-trait` crate usage patterns to the CONTRIBUTING.md file, establishing clear guidelines for when and how to use the `Pipe` trait in the codebase.
https://claude.ai/code/session_01DQYEAgJo7PnTgu9ejF1N1p
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
9
9
- Prefer merged imports
10
10
- Use descriptive generic names (`Size`, `Report`), not single letters
11
11
- Use descriptive variable and closure parameter names by default — single letters are only allowed in: conventional names (`n` for count, `f` for formatter), comparison closures (`|a, b|`), trivial single-expression closures, fold accumulators, index variables (`i`/`j`/`k` in short closures or index-based loops only), and test fixtures (identical roles only). Never use single letters in multi-line functions or closures
12
+
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
12
13
- Prefer `where` clauses for multiple trait bounds
Copy file name to clipboardExpand all lines: AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
9
9
- Prefer merged imports
10
10
- Use descriptive generic names (`Size`, `Report`), not single letters
11
11
- Use descriptive variable and closure parameter names by default — single letters are only allowed in: conventional names (`n` for count, `f` for formatter), comparison closures (`|a, b|`), trivial single-expression closures, fold accumulators, index variables (`i`/`j`/`k` in short closures or index-based loops only), and test fixtures (identical roles only). Never use single letters in multi-line functions or closures
12
+
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
12
13
- Prefer `where` clauses for multiple trait bounds
Copy file name to clipboardExpand all lines: CLAUDE.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
9
9
- Prefer merged imports
10
10
- Use descriptive generic names (`Size`, `Report`), not single letters
11
11
- Use descriptive variable and closure parameter names by default — single letters are only allowed in: conventional names (`n` for count, `f` for formatter), comparison closures (`|a, b|`), trivial single-expression closures, fold accumulators, index variables (`i`/`j`/`k` in short closures or index-based loops only), and test fixtures (identical roles only). Never use single letters in multi-line functions or closures
12
+
- Use `pipe-trait` for chaining through unary functions (constructors, `Some`, `Ok`, free functions, etc.), avoiding nested calls, and continuing method chains — but not for simple standalone calls (prefer `foo(value)` over `value.pipe(foo)`)
12
13
- Prefer `where` clauses for multiple trait bounds
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+98Lines changed: 98 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -210,6 +210,104 @@ pub enum RuntimeError {
210
210
}
211
211
```
212
212
213
+
### Using `pipe-trait`
214
+
215
+
This codebase uses the [`pipe-trait`](https://docs.rs/pipe-trait) crate extensively. The `Pipe` trait enables method-chaining through unary functions, keeping code in a natural left-to-right reading order. Import it as `use pipe_trait::Pipe;`.
216
+
217
+
Any callable that takes a single argument works with `.pipe()` — free functions, closures, newtype constructors, enum variant constructors, `Some`, `Ok`, `Err`, trait methods like `From::from`, etc. The guidance below applies equally to all of them.
218
+
219
+
#### When to use pipe
220
+
221
+
**Chaining through a unary function at the end of an expression chain:**
222
+
223
+
```rust
224
+
// Good — pipe keeps the chain flowing left-to-right
0 commit comments