diff --git a/src/compound-types.md b/src/compound-types.md index 16cb4168a..c648ff5ea 100644 --- a/src/compound-types.md +++ b/src/compound-types.md @@ -110,7 +110,7 @@ fn main() { let mut a = [1, 2, 3, 4, 5]; let first = a[0]; - + a[0] = 7; println!("The value of first is: {}", first); diff --git a/src/functions.md b/src/functions.md index fde2b554f..756859caf 100644 --- a/src/functions.md +++ b/src/functions.md @@ -298,7 +298,7 @@ fn main() { let y = { let z = 1; - + x + z + 5 }; diff --git a/src/if.md b/src/if.md index 258f5d46a..270491b72 100644 --- a/src/if.md +++ b/src/if.md @@ -31,7 +31,7 @@ fn main() { } else { println!("condition was false"); } -} +} ``` Let's try running it: @@ -160,7 +160,7 @@ fn main() { println!("The value of number is: {}", number); } -``` +``` Let’s run this: diff --git a/src/installation.md b/src/installation.md index 2192160f7..54eec5824 100644 --- a/src/installation.md +++ b/src/installation.md @@ -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, 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. diff --git a/src/loops.md b/src/loops.md index 58a19f6c3..31f065e79 100644 --- a/src/loops.md +++ b/src/loops.md @@ -184,7 +184,7 @@ Instead, we can use our last kind of loop: the `for` loop. It looks like this: fn main() { let a = [1, 2, 3, 4, 5]; let mut index = 0; - + for element in a.iter() { 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 ** -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** diff --git a/src/ownership.md b/src/ownership.md index 26471c63b..c77a617c7 100644 --- a/src/ownership.md +++ b/src/ownership.md @@ -2,7 +2,7 @@ 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 -language. +language. 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 diff --git a/src/references-and-borrowing.md b/src/references-and-borrowing.md index e020dc5e4..5a3c38922 100644 --- a/src/references-and-borrowing.md +++ b/src/references-and-borrowing.md @@ -54,7 +54,7 @@ Let’s take a closer look at the function call here: ```rust # fn calculate_length(s: &String) -> usize { # let length = s.len(); -# +# # length # } let s1 = String::from("hello"); diff --git a/src/slices.md b/src/slices.md index dcfee1776..cc6119a7c 100644 --- a/src/slices.md +++ b/src/slices.md @@ -78,13 +78,13 @@ that it will still be valid in the future. Consider this: ```rust # fn first_word(s: &String) -> usize { # let bytes = s.as_bytes(); -# +# # for (i, &byte) in bytes.iter().enumerate() { # if byte == 32 { # return i; # } # } -# +# # s.len() # } @@ -186,13 +186,13 @@ the slice version of `first_word()` will throw an error: ```rust,ignore # fn first_word(s: &String) -> &str { # let bytes = s.as_bytes(); -# +# # for (i, &byte) in bytes.iter().enumerate() { # if byte == 32 { # return &s[0..i]; # } # } -# +# # &s[..] # } fn main() { @@ -266,13 +266,13 @@ with no loss of functionality: ```rust # fn first_word(s: &str) -> &str { # let bytes = s.as_bytes(); -# +# # for (i, &byte) in bytes.iter().enumerate() { # if byte == 32 { # return &s[0..i]; # } # } -# +# # &s[..] # } fn main() { diff --git a/src/structs.md b/src/structs.md index f94e4dc2a..5d2bf3d52 100644 --- a/src/structs.md +++ b/src/structs.md @@ -23,11 +23,11 @@ fn main() { let x1 = 0.0; let y1 = 5.0; - let x2 = 12.0; + let x2 = 12.0; let y2 = 0.0; - + let answer = distance(x1, y1, x2, y2); - + println!("Point 1: ({}, {})", x1, y1); println!("Point 2: ({}, {})", x2, y2); println!("Distance: {}", answer); diff --git a/src/variable-bindings.md b/src/variable-bindings.md index b3f0de697..d9b8d0fc0 100644 --- a/src/variable-bindings.md +++ b/src/variable-bindings.md @@ -437,8 +437,8 @@ fn main() { let x = 5; 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."); } ``` @@ -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 will go out of scope now! The next curly brace is ending the main function."); } ``` @@ -483,7 +483,7 @@ fn main() { let x = 6; println!("The value of x is: {}", x); -} +} ``` Running it, we can see the shadowing in action: