We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d2f5d26 + 8483732 commit f5c192aCopy full SHA for f5c192a
src/doc/book/closures.md
@@ -510,12 +510,11 @@ fn factory() -> Box<Fn(i32) -> i32> {
510
511
Box::new(|x| x + num)
512
}
513
-# fn main() {
+
514
let f = factory();
515
516
let answer = f(1);
517
assert_eq!(6, answer);
518
-# }
519
```
520
521
There’s just one last problem:
@@ -540,12 +539,11 @@ fn factory() -> Box<Fn(i32) -> i32> {
540
539
541
Box::new(move |x| x + num)
542
543
-fn main() {
544
545
546
547
548
-}
549
550
551
By making the inner closure a `move Fn`, we create a new stack frame for our
0 commit comments