Skip to content

Commit c9483b0

Browse files
committed
Revise intro on wildcard patterns and capturing
Let's tighten up the wording a bit in the introduction to wildcard patterns and capturing to make it better match how we'll present things below. We'll remove the "for example..." ahead of the example, as we're not doing this below, and we'll separately extend the comments within the examples to include the relevant information.
1 parent ba36ec9 commit c9483b0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/types/closure.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,8 @@ If this were to capture `m`, then the closure would no longer outlive `'static`,
186186
r[type.closure.capture.precision.wildcard]
187187
### Wildcard pattern bindings
188188

189-
Closures only capture data that needs to be read.
190-
Binding a value with a [wildcard pattern] does not count as a read, and thus won't be captured.
191-
For example, the following closures will not capture `x`:
189+
r[type.closure.capture.precision.wildcard.reads]
190+
Closures only capture data that needs to be read. Binding a value with a [wildcard pattern] does not read the value, so the place is not captured.
192191

193192
```rust
194193
let x = String::from("hello");

0 commit comments

Comments
 (0)