Skip to content

Commit 5b65485

Browse files
authored
Remove unnecessary line in example
The pattern leveraging local variable shadowing has an unnecessary line (probably copy-pasta error from the previous example) and is missing a closing brace.
1 parent b737e1e commit 5b65485

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/2024h2/ergonomic-rc.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ Others adopt a slightly different pattern leveraging local variable shadowing:
4242
```rust
4343
let state = Arc::new(some_state);
4444

45-
let _state = state.clone();
4645
tokio::spawn({
4746
let state = state.clone();
4847
async move { /*code using `state`*/ }
49-
);
48+
});
5049
```
5150

5251
Whichever pattern users adopt, explicit clones of reference counted values leads to significant accidental complexity for many applications. As noted, cloning these values is both cheap at runtime and has zero semantic importance, since each clone is as good as the other.

0 commit comments

Comments
 (0)