Merge pull request #78 from Mark-Simulacrum/remove-space

Remove trailing spaces from all src files.
This commit is contained in:
Steve Klabnik
2016-02-17 12:30:44 -05:00
10 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ fn main() {
let mut a = [1, 2, 3, 4, 5]; let mut a = [1, 2, 3, 4, 5];
let first = a[0]; let first = a[0];
a[0] = 7; a[0] = 7;
println!("The value of first is: {}", first); println!("The value of first is: {}", first);
+1 -1
View File
@@ -298,7 +298,7 @@ fn main() {
let y = { let y = {
let z = 1; let z = 1;
x + z + 5 x + z + 5
}; };
+2 -2
View File
@@ -31,7 +31,7 @@ fn main() {
} else { } else {
println!("condition was false"); println!("condition was false");
} }
} }
``` ```
Let's try running it: Let's try running it:
@@ -160,7 +160,7 @@ fn main() {
println!("The value of number is: {}", number); println!("The value of number is: {}", number);
} }
``` ```
Let’s run this: Let’s run this:
+1 -1
View File
@@ -34,7 +34,7 @@ not want the script to run ‘sudo’ then pass it the --disable-sudo flag.
You may uninstall later by running /usr/local/lib/rustlib/uninstall.sh, You may uninstall later by running /usr/local/lib/rustlib/uninstall.sh,
or by running this script again with the --uninstall flag. or by running this script again with the --uninstall flag.
Continue? (y/N) Continue? (y/N)
``` ```
From here, press `y` for ‘yes’, and then follow the rest of the prompts. From here, press `y` for ‘yes’, and then follow the rest of the prompts.
+2 -2
View File
@@ -184,7 +184,7 @@ Instead, we can use our last kind of loop: the `for` loop. It looks like this:
fn main() { fn main() {
let a = [1, 2, 3, 4, 5]; let a = [1, 2, 3, 4, 5];
let mut index = 0; let mut index = 0;
for element in a.iter() { for element in a.iter() {
println!("the value is: {}", element); println!("the value is: {}", element);
} }
@@ -193,6 +193,6 @@ fn main() {
** NOTE: see [https://github.com/rust-lang/rust/issues/25725#issuecomment-166365658](https://github.com/rust-lang/rust/issues/25725#issuecomment-166365658), we may want to change this ** ** NOTE: see [https://github.com/rust-lang/rust/issues/25725#issuecomment-166365658](https://github.com/rust-lang/rust/issues/25725#issuecomment-166365658), we may want to change this **
If we run this, we'll see the same output as the previous example. If we run this, we'll see the same output as the previous example.
** I'm going to leave it at this for now until we decide how we want to do it** ** I'm going to leave it at this for now until we decide how we want to do it**
+1 -1
View File
@@ -2,7 +2,7 @@
Rust’s central feature is called ‘ownership’. It is a feature that is Rust’s central feature is called ‘ownership’. It is a feature that is
straightforward to explain, but has deep implications for the rest of the straightforward to explain, but has deep implications for the rest of the
language. language.
Rust is committed to both safety and speed. One of the key tools for balancing Rust is committed to both safety and speed. One of the key tools for balancing
between them is “zero-cost abstractions”: the various abstractions in Rust do between them is “zero-cost abstractions”: the various abstractions in Rust do
+1 -1
View File
@@ -54,7 +54,7 @@ Let’s take a closer look at the function call here:
```rust ```rust
# fn calculate_length(s: &String) -> usize { # fn calculate_length(s: &String) -> usize {
# let length = s.len(); # let length = s.len();
# #
# length # length
# } # }
let s1 = String::from("hello"); let s1 = String::from("hello");
+6 -6
View File
@@ -78,13 +78,13 @@ that it will still be valid in the future. Consider this:
```rust ```rust
# fn first_word(s: &String) -> usize { # fn first_word(s: &String) -> usize {
# let bytes = s.as_bytes(); # let bytes = s.as_bytes();
# #
# for (i, &byte) in bytes.iter().enumerate() { # for (i, &byte) in bytes.iter().enumerate() {
# if byte == 32 { # if byte == 32 {
# return i; # return i;
# } # }
# } # }
# #
# s.len() # s.len()
# } # }
@@ -186,13 +186,13 @@ the slice version of `first_word()` will throw an error:
```rust,ignore ```rust,ignore
# fn first_word(s: &String) -> &str { # fn first_word(s: &String) -> &str {
# let bytes = s.as_bytes(); # let bytes = s.as_bytes();
# #
# for (i, &byte) in bytes.iter().enumerate() { # for (i, &byte) in bytes.iter().enumerate() {
# if byte == 32 { # if byte == 32 {
# return &s[0..i]; # return &s[0..i];
# } # }
# } # }
# #
# &s[..] # &s[..]
# } # }
fn main() { fn main() {
@@ -266,13 +266,13 @@ with no loss of functionality:
```rust ```rust
# fn first_word(s: &str) -> &str { # fn first_word(s: &str) -> &str {
# let bytes = s.as_bytes(); # let bytes = s.as_bytes();
# #
# for (i, &byte) in bytes.iter().enumerate() { # for (i, &byte) in bytes.iter().enumerate() {
# if byte == 32 { # if byte == 32 {
# return &s[0..i]; # return &s[0..i];
# } # }
# } # }
# #
# &s[..] # &s[..]
# } # }
fn main() { fn main() {
+3 -3
View File
@@ -23,11 +23,11 @@ fn main() {
let x1 = 0.0; let x1 = 0.0;
let y1 = 5.0; let y1 = 5.0;
let x2 = 12.0; let x2 = 12.0;
let y2 = 0.0; let y2 = 0.0;
let answer = distance(x1, y1, x2, y2); let answer = distance(x1, y1, x2, y2);
println!("Point 1: ({}, {})", x1, y1); println!("Point 1: ({}, {})", x1, y1);
println!("Point 2: ({}, {})", x2, y2); println!("Point 2: ({}, {})", x2, y2);
println!("Distance: {}", answer); println!("Distance: {}", answer);
+4 -4
View File
@@ -437,8 +437,8 @@ fn main() {
let x = 5; let x = 5;
println!("x is now in scope"); println!("x is now in scope");
println!("In real code, we’d now do a bunch of work."); println!("In real code, we’d now do a bunch of work.");
println!("x will go out of scope now! The next curly brace is ending the main function."); println!("x will go out of scope now! The next curly brace is ending the main function.");
} }
``` ```
@@ -464,7 +464,7 @@ fn main() {
} }
println!("x is still in scope, but y is now out of scope and is not usable"); println!("x is still in scope, but y is now out of scope and is not usable");
println!("x will go out of scope now! The next curly brace is ending the main function."); println!("x will go out of scope now! The next curly brace is ending the main function.");
} }
``` ```
@@ -483,7 +483,7 @@ fn main() {
let x = 6; let x = 6;
println!("The value of x is: {}", x); println!("The value of x is: {}", x);
} }
``` ```
Running it, we can see the shadowing in action: Running it, we can see the shadowing in action: