about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPiotr Szotkowski <chastell@chastell.net>2014-10-26 09:50:16 +0100
committerPiotr Szotkowski <chastell@chastell.net>2014-10-26 09:50:16 +0100
commit4eedd873ec74dd67eb36808b5694e4834d0785ad (patch)
tree5ba8370be0dd56abba7150877aadce57ded87caa /src
parentf168c12c5629afd45c9b3ed250350bf830b99642 (diff)
downloadrust-4eedd873ec74dd67eb36808b5694e4834d0785ad.tar.gz
rust-4eedd873ec74dd67eb36808b5694e4834d0785ad.zip
Guide: Closures: minor wording fixes
Diffstat (limited to 'src')
-rw-r--r--src/doc/guide.md24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md
index c7b8e42b28c..9f84541e2d1 100644
--- a/src/doc/guide.md
+++ b/src/doc/guide.md
@@ -4010,8 +4010,8 @@ syntax.
 
 # Closures
 
-So far, we've made lots of functions in Rust. But we've given them all names.
-Rust also allows us to create anonymous functions too. Rust's anonymous
+So far, we've made lots of functions in Rust, but we've given them all names.
+Rust also allows us to create anonymous functions. Rust's anonymous
 functions are called **closure**s. By themselves, closures aren't all that
 interesting, but when you combine them with functions that take closures as
 arguments, really powerful things are possible.
@@ -4040,7 +4040,7 @@ don't need to declare one. This is different from named functions, which
 default to returning unit (`()`).
 
 There's one big difference between a closure and named functions, and it's in
-the name: a closure "closes over its environment." What's that mean? It means
+the name: a closure "closes over its environment." What does that mean? It means
 this:
 
 ```{rust}
@@ -4056,8 +4056,8 @@ fn main() {
 The `||` syntax means this is an anonymous closure that takes no arguments.
 Without it, we'd just have a block of code in `{}`s.
 
-In other words, a closure has access to variables in the scope that it's
-defined. The closure borrows any variables that it uses. This will error:
+In other words, a closure has access to variables in the scope where it's
+defined. The closure borrows any variables it uses, so this will error:
 
 ```{rust,ignore}
 fn main() {
@@ -4081,7 +4081,7 @@ let p = proc() { x * x };
 println!("{}", p()); // prints 25
 ```
 
-Procs have a big difference from closures: they may only be called once. This
+There is a big difference between procs and closures: procs may only be called once. This
 will error when we try to compile:
 
 ```{rust,ignore}
@@ -4174,10 +4174,10 @@ before. And we pass in our `x` argument to each one. Hence 'twice.'
 If you do the math, `(5 * 5) + (5 * 5) == 50`, so that's the output we get.
 
 Play around with this concept until you're comfortable with it. Rust's standard
-library uses lots of closures, where appropriate, so you'll be using
+library uses lots of closures where appropriate, so you'll be using
 this technique a lot.
 
-If we didn't want to give `square` a name, we could also just define it inline.
+If we didn't want to give `square` a name, we could just define it inline.
 This example is the same as the previous one:
 
 ```{rust}
@@ -4205,12 +4205,12 @@ fn main() {
 }
 ```
 
-Doing this is not particularly common, but every once in a while, it's useful.
+Doing this is not particularly common, but it's useful every once in a while.
 
 That's all you need to get the hang of closures! Closures are a little bit
-strange at first, but once you're used to using them, you'll miss them in any
-language that doesn't have them. Passing functions to other functions is
-incredibly powerful. Next, let's look at one of those things: iterators.
+strange at first, but once you're used to them, you'll miss them
+in other languages. Passing functions to other functions is
+incredibly powerful; let's look at one of such situations: iterators.
 
 # Iterators