diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d984eb..a96df52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,14 +83,14 @@ * Update deps to version compatable with aarch64-pc-windows (#263) ([19a93428](https://github.com/rust-lang/rustlings/commit/19a93428b3c73d994292671f829bdc8e5b7b3401)) * **docs:** * Added a necessary step to Windows installation process (#242) ([3906efcd](https://github.com/rust-lang/rustlings/commit/3906efcd52a004047b460ed548037093de3f523f)) - * Fixed mangled sentence from book; edited for clarity (#266) ([ade52ff](https://github.com/rust-lang/rustlings/commit/ade52ffb739987287ddd5705944c8777705faed9)) + * Fixed mangled sentence from book; edited for clarity (#266) ([ade52ff](https://github.com/rust-lang/rustlings/commit/ade52ffb739987287ddd5705944c8777705faed9)) * Updated iterators readme to account for iterators4 exercise (#273) ([bec8e3a](https://github.com/rust-lang/rustlings/commit/bec8e3a644cbd88db1c73ea5f1d8a364f4a34016)) * **installation:** make fatal errors more obvious (#272) ([17d0951e](https://github.com/rust-lang/rustlings/commit/17d0951e66fda8e11b204d5c4c41a0d5e22e78f7)) * **iterators2:** * Remove reference to missing iterators2.rs (#245) ([419f7797](https://github.com/rust-lang/rustlings/commit/419f7797f294e4ce6a2b883199731b5bde77d262)) * **as_ref_mut:** Enable a test and improve per clippy's suggestion (#256) ([dfdf809](https://github.com/rust-lang/rustlings/commit/dfdf8093ebbd4145864995627b812780de52f902)) * **tests1:** - * Change test command ([fe10e06c](https://github.com/rust-lang/rustlings/commit/fe10e06c3733ddb4a21e90d09bf79bfe618e97ce) + * Change test command ([fe10e06c](https://github.com/rust-lang/rustlings/commit/fe10e06c3733ddb4a21e90d09bf79bfe618e97ce) * Correct test command in tests1.rs comment (#263) ([39fa7ae](https://github.com/rust-lang/rustlings/commit/39fa7ae8b70ad468da49b06f11b2383135a63bcf)) #### Features diff --git a/exercises/enums/README.md b/exercises/enums/README.md index a090a43..091f5d0 100644 --- a/exercises/enums/README.md +++ b/exercises/enums/README.md @@ -1,8 +1,8 @@ ### Enums -Rust allows you to define types called "enums" which enumerate possible values. +Rust allows you to define types called "enums" which enumerate possible values. Enums are a feature in many languages, but their capabilities differ in each language. Rust’s enums are most similar to algebraic data types in functional languages, such as F#, OCaml, and Haskell. -Useful in combination with enums is Rust's "pattern matching" facility, which makes it easy to run different code for different values of an enumeration. +Useful in combination with enums is Rust's "pattern matching" facility, which makes it easy to run different code for different values of an enumeration. #### Book Sections diff --git a/exercises/error_handling/README.md b/exercises/error_handling/README.md index cf66c2b..77a58d1 100644 --- a/exercises/error_handling/README.md +++ b/exercises/error_handling/README.md @@ -1,5 +1,5 @@ For this exercise check out the sections: -- [Error Handling](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html) -- [Generics](https://doc.rust-lang.org/book/ch10-01-syntax.html) +- [Error Handling](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html) +- [Generics](https://doc.rust-lang.org/book/ch10-01-syntax.html) of the Rust Book. diff --git a/exercises/generics/generics3.rs b/exercises/generics/generics3.rs index 6f95145..64dd9bc 100644 --- a/exercises/generics/generics3.rs +++ b/exercises/generics/generics3.rs @@ -4,8 +4,8 @@ // However, the school also issues alphabetical grades (A+ -> F-) and needs // to be able to print both types of report card! -// Make the necessary code changes in the struct ReportCard and the impl block -// to support alphabetical report cards. Change the Grade in the second test to "A+" +// Make the necessary code changes in the struct ReportCard and the impl block +// to support alphabetical report cards. Change the Grade in the second test to "A+" // to show that your changes allow alphabetical grades. // Execute 'rustlings hint generics3' for hints! diff --git a/exercises/traits/README.md b/exercises/traits/README.md index 1ce46fe..8cd03ec 100644 --- a/exercises/traits/README.md +++ b/exercises/traits/README.md @@ -1,6 +1,6 @@ ### Traits -A trait is a collection of methods. +A trait is a collection of methods. Data types can implement traits. To do so, the methods making up the trait are defined for the data type. For example, the `String` data type implements the `From<&str>` trait. This allows a user to write `String::from("hello")`. @@ -8,7 +8,7 @@ In this way, traits are somewhat similar to Java interfaces and C++ abstract cla Some additional common Rust traits include: -+ `Clone` (the `clone` method), ++ `Clone` (the `clone` method), + `Display` (which allows formatted display via `{}`), and + `Debug` (which allows formatted display via `{:?}`). @@ -17,4 +17,4 @@ Because traits indicate shared behavior between data types, they are useful when #### Book Sections -- [Traits](https://doc.rust-lang.org/book/ch10-02-traits.html) \ No newline at end of file +- [Traits](https://doc.rust-lang.org/book/ch10-02-traits.html) diff --git a/info.toml b/info.toml index 46e353f..a64509e 100644 --- a/info.toml +++ b/info.toml @@ -52,7 +52,7 @@ because we want to assign a different typed value to an existing variable. Somet you may also like to reuse existing variable names because you are just converting values to different types like in this exercise. Fortunately Rust has a powerful solution to this problem: 'Shadowing'! -You can read more about 'Shadowing' in the book's section 'Variables and Mutability': +You can read more about 'Shadowing' in the book's section 'Variables and Mutability': https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing Try to solve this exercise afterwards using this technique.""" @@ -61,13 +61,13 @@ name = "variables6" path = "exercises/variables/variables6.rs" mode = "compile" hint = """ -We know about variables and mutability, but there is another important type of -variable available; constants. -Constants are always immutable and they are declared with keyword 'const' rather +We know about variables and mutability, but there is another important type of +variable available; constants. +Constants are always immutable and they are declared with keyword 'const' rather than keyword 'let'. Constants types must also always be annotated. -Read more about constants under 'Differences Between Variables and Constants' in the book's section 'Variables and Mutability': +Read more about constants under 'Differences Between Variables and Constants' in the book's section 'Variables and Mutability': https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants """ @@ -237,8 +237,8 @@ name = "structs2" path = "exercises/structs/structs2.rs" mode = "test" hint = """ -Creating instances of structs is easy, all you need to do is assign some values to its fields. -There is however some shortcuts that can be taken when instantiating structs. +Creating instances of structs is easy, all you need to do is assign some values to its fields. +There is however some shortcuts that can be taken when instantiating structs. Have a look in The Book, to find out more: https://doc.rust-lang.org/stable/book/ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax""" [[exercises]] @@ -682,8 +682,8 @@ name = "iterators4" path = "exercises/standard_library_types/iterators4.rs" mode = "test" hint = """ -In an imperative language, you might write a for loop that updates -a mutable variable. Or, you might write code utilizing recursion +In an imperative language, you might write a for loop that updates +a mutable variable. Or, you might write code utilizing recursion and a match clause. In Rust you can take another functional approach, computing the factorial elegantly with ranges and iterators.""" @@ -703,10 +703,10 @@ name = "traits2" path = "exercises/traits/traits2.rs" mode = "test" hint = """ -Notice how the trait takes ownership of 'self',and returns `Self'. +Notice how the trait takes ownership of 'self',and returns `Self'. Try mutating the incoming string vector. -Vectors provide suitable methods for adding an element at the end. See +Vectors provide suitable methods for adding an element at the end. See the documentation at: https://doc.rust-lang.org/std/vec/struct.Vec.html""" # Generics @@ -724,7 +724,7 @@ name = "generics2" path = "exercises/generics/generics2.rs" mode = "test" hint = """ -Currently we are wrapping only values of type 'u32'. +Currently we are wrapping only values of type 'u32'. Maybe we could update the explicit references to this data type somehow? If you are still stuck https://doc.rust-lang.org/stable/book/ch10-01-syntax.html#in-method-definitions @@ -735,7 +735,7 @@ name = "generics3" path = "exercises/generics/generics3.rs" mode = "test" hint = """ -To find the best solution to this challenge you're going to need to think back to your +To find the best solution to this challenge you're going to need to think back to your knowledge of traits, specifically Trait Bound Syntax - you may also need this: "use std::fmt::Display;" This is definitely harder than the last two exercises! You need to think about not only making the diff --git a/install.ps1 b/install.ps1 index 6504e69..f7472ad 100644 --- a/install.ps1 +++ b/install.ps1 @@ -35,7 +35,7 @@ if (Get-Command cargo -ErrorAction SilentlyContinue) { function vercomp($v1, $v2) { if ($v1 -eq $v2) { return 0 - } + } $v1 = $v1.Replace(".", "0") $v2 = $v2.Replace(".", "0")