diff --git a/src/doc/book/closures.md b/src/doc/book/closures.md index b306ce5db16..b7b67a9f1d0 100644 --- a/src/doc/book/closures.md +++ b/src/doc/book/closures.md @@ -511,12 +511,10 @@ fn factory() -> Box i32> { Box::new(|x| x + num) } -# fn main() { let f = factory(); let answer = f(1); assert_eq!(6, answer); -# } ``` There’s just one last problem: @@ -542,12 +540,10 @@ fn factory() -> Box i32> { Box::new(move |x| x + num) } -# fn main() { let f = factory(); let answer = f(1); assert_eq!(6, answer); -# } ``` By making the inner closure a `move Fn`, we create a new stack frame for our