Skip to content

Commit 084325f

Browse files
committed
auto merge of #16722 : tshepang/rust/trailing-spaces, r=pcwalton
2 parents 5ad7afc + 3aa0a14 commit 084325f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/doc/guide.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ And trying it out:
20212021
```{notrust,ignore}
20222022
$ cargo build
20232023
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2024-
$ ./target/guessing_game
2024+
$ ./target/guessing_game
20252025
Guess the number!
20262026
The secret number is: 57
20272027
Please input your guess.
@@ -2292,7 +2292,7 @@ print an error message and return. Let's give this a shot:
22922292
```{notrust,ignore}
22932293
$ cargo build
22942294
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2295-
$ ./target/guessing_game
2295+
$ ./target/guessing_game
22962296
Guess the number!
22972297
The secret number is: 17
22982298
Please input your guess.
@@ -2358,11 +2358,11 @@ Let's try it!
23582358
```{notrust,ignore}
23592359
$ cargo build
23602360
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2361-
$ ./target/guessing_game
2361+
$ ./target/guessing_game
23622362
Guess the number!
23632363
The secret number is: 58
23642364
Please input your guess.
2365-
76
2365+
76
23662366
You guessed: 76
23672367
Too big!
23682368
$
@@ -2436,7 +2436,7 @@ that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24362436
```{notrust,ignore}
24372437
$ cargo build
24382438
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2439-
$ ./target/guessing_game
2439+
$ ./target/guessing_game
24402440
Guess the number!
24412441
The secret number is: 59
24422442
Please input your guess.
@@ -2569,7 +2569,7 @@ Now we should be good! Let's try:
25692569
```{rust,ignore}
25702570
$ cargo build
25712571
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2572-
$ ./target/guessing_game
2572+
$ ./target/guessing_game
25732573
Guess the number!
25742574
The secret number is: 61
25752575
Please input your guess.
@@ -3718,18 +3718,18 @@ That's a lot to take in. It's also one of the _most_ important concepts in
37183718
all of Rust. Let's see this syntax in action:
37193719

37203720
```{rust}
3721-
{
3721+
{
37223722
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37233723
37243724
// other code here...
3725-
3725+
37263726
} // privilege 1: when x goes out of scope, this memory is deallocated
37273727
37283728
/// this function borrows an integer. It's given back automatically when the
37293729
/// function returns.
3730-
fn foo(x: &int) -> &int { x }
3730+
fn foo(x: &int) -> &int { x }
37313731
3732-
{
3732+
{
37333733
let x = 5i; // x is the owner of this integer, which is memory on the stack.
37343734
37353735
// privilege 2: you may lend that resource, to as many borrowers as you'd like
@@ -3739,14 +3739,14 @@ fn foo(x: &int) -> &int { x }
37393739
foo(&x); // functions can borrow too!
37403740
37413741
let a = &x; // we can do this alllllll day!
3742-
}
3742+
}
37433743
3744-
{
3744+
{
37453745
let mut x = 5i; // x is the owner of this integer, which is memory on the stack.
37463746
37473747
let y = &mut x; // privilege 3: you may lend that resource to a single borrower,
37483748
// mutably
3749-
}
3749+
}
37503750
```
37513751

37523752
If you are a borrower, you get a few privileges as well, but must also obey a
@@ -4535,7 +4535,7 @@ let one_to_one_hundred = range(0i, 100i).collect();
45354535
```
45364536

45374537
As you can see, we call `collect()` on our iterator. `collect()` takes
4538-
as many values as the iterator will give it, and returns a collection
4538+
as many values as the iterator will give it, and returns a collection
45394539
of the results. So why won't this compile? Rust can't determine what
45404540
type of things you want to collect, and so you need to let it know.
45414541
Here's the version that does compile:
@@ -5508,7 +5508,7 @@ fn main() {
55085508
}
55095509
```
55105510

5511-
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
5511+
Whew! This isn't too terrible. You can see that we still `let x = 5i`,
55125512
but then things get a little bit hairy. Three more bindings get set: a
55135513
static format string, an argument vector, and the aruments. We then
55145514
invoke the `println_args` function with the generated arguments.

0 commit comments

Comments
 (0)