Skip to content

Commit

Permalink
Removed commented main functions entirely. This fits in with other ex…
Browse files Browse the repository at this point in the history
…amples in the Closures section
  • Loading branch information
buntine committed Oct 31, 2016
1 parent 32fb252 commit 8483732
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/doc/book/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,10 @@ fn factory() -> Box<Fn(i32) -> 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:
Expand All @@ -542,12 +540,10 @@ fn factory() -> Box<Fn(i32) -> 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
Expand Down

0 comments on commit 8483732

Please sign in to comment.