Skip to content

Commit

Permalink
Commented out final 'main' function in order to fit within pattern of…
Browse files Browse the repository at this point in the history
… other examples and prevent incorrect indentation
  • Loading branch information
buntine committed Oct 31, 2016
1 parent 4497196 commit 32fb252
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/doc/book/closures.md
Expand Up @@ -510,6 +510,7 @@ fn factory() -> Box<Fn(i32) -> i32> {
Box::new(|x| x + num)
}
# fn main() {
let f = factory();
Expand Down Expand Up @@ -540,12 +541,13 @@ fn factory() -> Box<Fn(i32) -> i32> {

Box::new(move |x| x + num)
}
fn main() {

# 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
Expand Down

0 comments on commit 32fb252

Please sign in to comment.