Skip to content

Commit f5c192a

Browse files
Rollup merge of #37495 - buntine:master, r=steveklabnik
Commented out final 'main' function in order to fit within pattern of… … other examples and prevent incorrect indentation
2 parents d2f5d26 + 8483732 commit f5c192a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/doc/book/closures.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,11 @@ fn factory() -> Box<Fn(i32) -> i32> {
510510
511511
Box::new(|x| x + num)
512512
}
513-
# fn main() {
513+
514514
let f = factory();
515515
516516
let answer = f(1);
517517
assert_eq!(6, answer);
518-
# }
519518
```
520519

521520
There’s just one last problem:
@@ -540,12 +539,11 @@ fn factory() -> Box<Fn(i32) -> i32> {
540539

541540
Box::new(move |x| x + num)
542541
}
543-
fn main() {
542+
544543
let f = factory();
545544

546545
let answer = f(1);
547546
assert_eq!(6, answer);
548-
}
549547
```
550548

551549
By making the inner closure a `move Fn`, we create a new stack frame for our

0 commit comments

Comments
 (0)