From 5ff23a286185daef544c72b00f90567183898929 Mon Sep 17 00:00:00 2001 From: Mikael Frosthage Date: Tue, 26 Jul 2022 22:02:50 +0200 Subject: [PATCH 01/52] Improve hint for as_ref_mut --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index f07b9267..c3b0ca84 100644 --- a/info.toml +++ b/info.toml @@ -1135,4 +1135,4 @@ name = "as_ref_mut" path = "exercises/conversions/as_ref_mut.rs" mode = "test" hint = """ -Add AsRef as a trait bound to the functions.""" +Add AsRef or AsMut as a trait bound to the functions.""" From a7257a1d1ef59642f692e2638085ec00a6f2f391 Mon Sep 17 00:00:00 2001 From: b1ue64 <77976308+b1ue64@users.noreply.github.com> Date: Sat, 20 May 2023 16:38:33 -0400 Subject: [PATCH 02/52] feat(iterators5): remove outdated part of hint --- info.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/info.toml b/info.toml index ac04fc7d..2add5f0c 100644 --- a/info.toml +++ b/info.toml @@ -897,9 +897,6 @@ hint = """ The documentation for the std::iter::Iterator trait contains numerous methods that would be helpful here. -Return 0 from count_collection_iterator to make the code compile in order to -test count_iterator. - The collection variable in count_collection_iterator is a slice of HashMaps. It needs to be converted into an iterator in order to use the iterator methods. From 8e62346f8625965f1dac9603f3297e726670b3d3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 21 May 2023 09:39:25 +0000 Subject: [PATCH 03/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index a27c60e9..e0631ce8 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -300,6 +300,9 @@ authors. lionel-rowe
lionel-rowe

πŸ–‹ Ben
Ben

πŸ–‹ + + b1ue64
b1ue64

πŸ–‹ + From 15ad02c984ef355a451189b2708b93112afc1840 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 21 May 2023 09:39:26 +0000 Subject: [PATCH 04/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 1b9678e0..7978d245 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2118,6 +2118,15 @@ "contributions": [ "content" ] + }, + { + "login": "b1ue64", + "name": "b1ue64", + "avatar_url": "https://avatars.githubusercontent.com/u/77976308?v=4", + "profile": "https://github.com/b1ue64", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From e35a84fcb3f448aa3c455fab8c3a6a13fd47e606 Mon Sep 17 00:00:00 2001 From: liv Date: Mon, 22 May 2023 11:09:57 +0200 Subject: [PATCH 05/52] chore(oranda): don't generate changelog pages --- oranda.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oranda.json b/oranda.json index 08cc234d..18ef8c68 100644 --- a/oranda.json +++ b/oranda.json @@ -6,5 +6,5 @@ "domain": "rustlings.cool" } }, - "changelog": true + "changelog": false } From 9604ab66218a83710e0da1152ec75b5574f051a8 Mon Sep 17 00:00:00 2001 From: lazywalker Date: Tue, 23 May 2023 15:00:55 +0800 Subject: [PATCH 06/52] fix(exercises): use snake_case variables --- exercises/iterators/iterators5.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/exercises/iterators/iterators5.rs b/exercises/iterators/iterators5.rs index dcf0742d..d0fcc8ca 100644 --- a/exercises/iterators/iterators5.rs +++ b/exercises/iterators/iterators5.rs @@ -79,11 +79,11 @@ mod tests { #[test] fn count_complete_equals_for() { let map = get_map(); - let progressStates = vec![Progress::Complete, Progress::Some, Progress::None]; - for progressState in progressStates { + let progress_states = vec![Progress::Complete, Progress::Some, Progress::None]; + for progress_state in progress_states { assert_eq!( - count_for(&map, progressState), - count_iterator(&map, progressState) + count_for(&map, progress_state), + count_iterator(&map, progress_state) ); } } @@ -111,13 +111,13 @@ mod tests { #[test] fn count_collection_equals_for() { - let progressStates = vec![Progress::Complete, Progress::Some, Progress::None]; + let progress_states = vec![Progress::Complete, Progress::Some, Progress::None]; let collection = get_vec_map(); - for progressState in progressStates { + for progress_state in progress_states { assert_eq!( - count_collection_for(&collection, progressState), - count_collection_iterator(&collection, progressState) + count_collection_for(&collection, progress_state), + count_collection_iterator(&collection, progress_state) ); } } From b9cb9311672babb938127385a102a645d86e4cac Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 23 May 2023 09:05:58 +0000 Subject: [PATCH 07/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index e0631ce8..50a477c0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -302,6 +302,7 @@ authors. b1ue64
b1ue64

πŸ–‹ + lazywalker
lazywalker

πŸ–‹ From 33224370eb98da79a2a0b1d6a470cfa6edab83f2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 23 May 2023 09:05:59 +0000 Subject: [PATCH 08/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7978d245..14ec3a98 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2127,6 +2127,15 @@ "contributions": [ "content" ] + }, + { + "login": "lazywalker", + "name": "lazywalker", + "avatar_url": "https://avatars.githubusercontent.com/u/53956?v=4", + "profile": "https://github.com/lazywalker", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 7eef5d15eef780f93e22b1b4e0185f7708219ea0 Mon Sep 17 00:00:00 2001 From: Robert Fry Date: Mon, 29 May 2023 18:39:08 +0100 Subject: [PATCH 09/52] docs: cleanup the explanation paragraphs at the start of each exercise. --- exercises/clippy/clippy1.rs | 13 +++--- exercises/clippy/clippy2.rs | 4 +- exercises/clippy/clippy3.rs | 3 ++ exercises/conversions/as_ref_mut.rs | 12 ++++-- exercises/conversions/from_into.rs | 40 +++++++++++-------- exercises/conversions/from_str.rs | 30 ++++++++------ exercises/conversions/try_from_into.rs | 27 +++++++------ exercises/conversions/using_as.rs | 16 +++++--- exercises/enums/enums1.rs | 1 + exercises/enums/enums2.rs | 4 +- exercises/enums/enums3.rs | 11 +++-- exercises/error_handling/errors1.rs | 14 ++++--- exercises/error_handling/errors2.rs | 30 +++++++------- exercises/error_handling/errors3.rs | 5 ++- exercises/error_handling/errors4.rs | 4 +- exercises/error_handling/errors5.rs | 36 ++++++++++------- exercises/error_handling/errors6.rs | 13 +++--- exercises/functions/functions1.rs | 4 +- exercises/functions/functions2.rs | 4 +- exercises/functions/functions3.rs | 4 +- exercises/functions/functions4.rs | 15 +++---- exercises/functions/functions5.rs | 4 +- exercises/generics/generics1.rs | 11 +++-- exercises/generics/generics2.rs | 7 +++- exercises/hashmaps/hashmaps1.rs | 15 +++---- exercises/hashmaps/hashmaps2.rs | 27 +++++++------ exercises/hashmaps/hashmaps3.rs | 24 +++++------ exercises/if/if1.rs | 1 + exercises/if/if2.rs | 3 +- exercises/intro/intro1.rs | 12 ++++-- exercises/intro/intro2.rs | 5 ++- exercises/iterators/iterators1.rs | 11 ++--- exercises/iterators/iterators2.rs | 5 ++- exercises/iterators/iterators3.rs | 15 ++++--- exercises/iterators/iterators4.rs | 4 +- exercises/iterators/iterators5.rs | 5 ++- exercises/lifetimes/lifetimes1.rs | 9 +++-- exercises/lifetimes/lifetimes2.rs | 8 ++-- exercises/lifetimes/lifetimes3.rs | 3 +- exercises/macros/macros1.rs | 4 +- exercises/macros/macros2.rs | 4 +- exercises/macros/macros3.rs | 5 ++- exercises/macros/macros4.rs | 4 +- exercises/modules/modules1.rs | 4 +- exercises/modules/modules2.rs | 10 +++-- exercises/modules/modules3.rs | 13 +++--- exercises/move_semantics/move_semantics1.rs | 4 +- exercises/move_semantics/move_semantics2.rs | 6 ++- exercises/move_semantics/move_semantics3.rs | 9 +++-- exercises/move_semantics/move_semantics4.rs | 11 +++-- exercises/move_semantics/move_semantics5.rs | 9 +++-- exercises/move_semantics/move_semantics6.rs | 5 ++- exercises/options/options1.rs | 12 ++++-- exercises/options/options2.rs | 9 +++-- exercises/options/options3.rs | 4 +- exercises/primitive_types/primitive_types1.rs | 8 +++- exercises/primitive_types/primitive_types2.rs | 8 +++- exercises/primitive_types/primitive_types3.rs | 5 ++- exercises/primitive_types/primitive_types4.rs | 5 ++- exercises/primitive_types/primitive_types5.rs | 5 ++- exercises/primitive_types/primitive_types6.rs | 9 +++-- exercises/quiz1.rs | 9 +++-- exercises/quiz2.rs | 10 +++-- exercises/quiz3.rs | 20 +++++----- exercises/smart_pointers/arc1.rs | 19 +++++---- exercises/smart_pointers/box1.rs | 16 ++++---- exercises/smart_pointers/cow1.rs | 29 ++++++++------ exercises/smart_pointers/rc1.rs | 15 ++++--- exercises/strings/strings1.rs | 5 ++- exercises/strings/strings2.rs | 5 ++- exercises/strings/strings3.rs | 4 +- exercises/strings/strings4.rs | 3 +- exercises/structs/structs1.rs | 5 ++- exercises/structs/structs2.rs | 5 ++- exercises/structs/structs3.rs | 5 ++- exercises/tests/tests1.rs | 17 ++++---- exercises/tests/tests2.rs | 9 +++-- exercises/tests/tests3.rs | 9 +++-- exercises/tests/tests4.rs | 5 ++- exercises/threads/threads1.rs | 14 ++++--- exercises/threads/threads2.rs | 15 ++++--- exercises/threads/threads3.rs | 4 +- exercises/traits/traits1.rs | 12 +++--- exercises/traits/traits2.rs | 11 ++--- exercises/traits/traits3.rs | 9 +++-- exercises/traits/traits4.rs | 5 ++- exercises/traits/traits5.rs | 5 ++- exercises/variables/variables1.rs | 5 ++- exercises/variables/variables2.rs | 4 +- exercises/variables/variables3.rs | 4 +- exercises/variables/variables4.rs | 4 +- exercises/variables/variables5.rs | 4 +- exercises/variables/variables6.rs | 4 +- exercises/vecs/vecs1.rs | 7 +++- exercises/vecs/vecs2.rs | 5 ++- 95 files changed, 577 insertions(+), 337 deletions(-) diff --git a/exercises/clippy/clippy1.rs b/exercises/clippy/clippy1.rs index bad46891..95c0141f 100644 --- a/exercises/clippy/clippy1.rs +++ b/exercises/clippy/clippy1.rs @@ -1,10 +1,13 @@ // clippy1.rs -// The Clippy tool is a collection of lints to analyze your code -// so you can catch common mistakes and improve your Rust code. // -// For these exercises the code will fail to compile when there are clippy warnings -// check clippy's suggestions from the output to solve the exercise. -// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a hint. +// The Clippy tool is a collection of lints to analyze your code so you can +// catch common mistakes and improve your Rust code. +// +// For these exercises the code will fail to compile when there are clippy +// warnings check clippy's suggestions from the output to solve the exercise. +// +// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/clippy/clippy2.rs b/exercises/clippy/clippy2.rs index dac40dbe..9b87a0b7 100644 --- a/exercises/clippy/clippy2.rs +++ b/exercises/clippy/clippy2.rs @@ -1,5 +1,7 @@ // clippy2.rs -// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/clippy/clippy3.rs b/exercises/clippy/clippy3.rs index b0159ebe..35021f84 100644 --- a/exercises/clippy/clippy3.rs +++ b/exercises/clippy/clippy3.rs @@ -1,5 +1,8 @@ // clippy3.rs +// // Here's a couple more easy Clippy fixes, so you can see its utility. +// +// Execute `rustlings hint clippy3` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/conversions/as_ref_mut.rs b/exercises/conversions/as_ref_mut.rs index e6a9d114..626a36c4 100644 --- a/exercises/conversions/as_ref_mut.rs +++ b/exercises/conversions/as_ref_mut.rs @@ -1,7 +1,11 @@ -// AsRef and AsMut allow for cheap reference-to-reference conversions. -// Read more about them at https://doc.rust-lang.org/std/convert/trait.AsRef.html -// and https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively. -// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a hint. +// as_ref_mut.rs +// +// AsRef and AsMut allow for cheap reference-to-reference conversions. Read more +// about them at https://doc.rust-lang.org/std/convert/trait.AsRef.html and +// https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively. +// +// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/conversions/from_into.rs b/exercises/conversions/from_into.rs index 6c272c3b..aba471d9 100644 --- a/exercises/conversions/from_into.rs +++ b/exercises/conversions/from_into.rs @@ -1,7 +1,11 @@ -// The From trait is used for value-to-value conversions. -// If From is implemented correctly for a type, the Into trait should work conversely. -// You can read more about it at https://doc.rust-lang.org/std/convert/trait.From.html -// Execute `rustlings hint from_into` or use the `hint` watch subcommand for a hint. +// from_into.rs +// +// The From trait is used for value-to-value conversions. If From is implemented +// correctly for a type, the Into trait should work conversely. You can read +// more about it at https://doc.rust-lang.org/std/convert/trait.From.html +// +// Execute `rustlings hint from_into` or use the `hint` watch subcommand for a +// hint. #[derive(Debug)] struct Person { @@ -20,20 +24,21 @@ impl Default for Person { } } -// Your task is to complete this implementation -// in order for the line `let p = Person::from("Mark,20")` to compile -// Please note that you'll need to parse the age component into a `usize` -// with something like `"4".parse::()`. The outcome of this needs to -// be handled appropriately. +// Your task is to complete this implementation in order for the line `let p = +// Person::from("Mark,20")` to compile Please note that you'll need to parse the +// age component into a `usize` with something like `"4".parse::()`. The +// outcome of this needs to be handled appropriately. // // Steps: -// 1. If the length of the provided string is 0, then return the default of Person -// 2. Split the given string on the commas present in it -// 3. Extract the first element from the split operation and use it as the name -// 4. If the name is empty, then return the default of Person -// 5. Extract the other element from the split operation and parse it into a `usize` as the age -// If while parsing the age, something goes wrong, then return the default of Person -// Otherwise, then return an instantiated Person object with the results +// 1. If the length of the provided string is 0, then return the default of +// Person. +// 2. Split the given string on the commas present in it. +// 3. Extract the first element from the split operation and use it as the name. +// 4. If the name is empty, then return the default of Person. +// 5. Extract the other element from the split operation and parse it into a +// `usize` as the age. +// If while parsing the age, something goes wrong, then return the default of +// Person Otherwise, then return an instantiated Person object with the results // I AM NOT DONE @@ -77,7 +82,8 @@ mod tests { } #[test] fn test_bad_age() { - // Test that "Mark,twenty" will return the default person due to an error in parsing age + // Test that "Mark,twenty" will return the default person due to an + // error in parsing age let p = Person::from("Mark,twenty"); assert_eq!(p.name, "John"); assert_eq!(p.age, 30); diff --git a/exercises/conversions/from_str.rs b/exercises/conversions/from_str.rs index fe168159..34472c32 100644 --- a/exercises/conversions/from_str.rs +++ b/exercises/conversions/from_str.rs @@ -1,10 +1,13 @@ // from_str.rs -// This is similar to from_into.rs, but this time we'll implement `FromStr` -// and return errors instead of falling back to a default value. -// Additionally, upon implementing FromStr, you can use the `parse` method -// on strings to generate an object of the implementor type. -// You can read more about it at https://doc.rust-lang.org/std/str/trait.FromStr.html -// Execute `rustlings hint from_str` or use the `hint` watch subcommand for a hint. +// +// This is similar to from_into.rs, but this time we'll implement `FromStr` and +// return errors instead of falling back to a default value. Additionally, upon +// implementing FromStr, you can use the `parse` method on strings to generate +// an object of the implementor type. You can read more about it at +// https://doc.rust-lang.org/std/str/trait.FromStr.html +// +// Execute `rustlings hint from_str` or use the `hint` watch subcommand for a +// hint. use std::num::ParseIntError; use std::str::FromStr; @@ -33,15 +36,18 @@ enum ParsePersonError { // Steps: // 1. If the length of the provided string is 0, an error should be returned // 2. Split the given string on the commas present in it -// 3. Only 2 elements should be returned from the split, otherwise return an error +// 3. Only 2 elements should be returned from the split, otherwise return an +// error // 4. Extract the first element from the split operation and use it as the name -// 5. Extract the other element from the split operation and parse it into a `usize` as the age -// with something like `"4".parse::()` -// 6. If while extracting the name and the age something goes wrong, an error should be returned +// 5. Extract the other element from the split operation and parse it into a +// `usize` as the age with something like `"4".parse::()` +// 6. If while extracting the name and the age something goes wrong, an error +// should be returned // If everything goes well, then return a Result of a Person object // -// As an aside: `Box` implements `From<&'_ str>`. This means that if you want to return a -// string error message, you can do so via just using return `Err("my error message".into())`. +// As an aside: `Box` implements `From<&'_ str>`. This means that if +// you want to return a string error message, you can do so via just using +// return `Err("my error message".into())`. impl FromStr for Person { type Err = ParsePersonError; diff --git a/exercises/conversions/try_from_into.rs b/exercises/conversions/try_from_into.rs index fa98bc90..32d6ef39 100644 --- a/exercises/conversions/try_from_into.rs +++ b/exercises/conversions/try_from_into.rs @@ -1,9 +1,13 @@ // try_from_into.rs -// TryFrom is a simple and safe type conversion that may fail in a controlled way under some circumstances. -// Basically, this is the same as From. The main difference is that this should return a Result type -// instead of the target type itself. -// You can read more about it at https://doc.rust-lang.org/std/convert/trait.TryFrom.html -// Execute `rustlings hint try_from_into` or use the `hint` watch subcommand for a hint. +// +// TryFrom is a simple and safe type conversion that may fail in a controlled +// way under some circumstances. Basically, this is the same as From. The main +// difference is that this should return a Result type instead of the target +// type itself. You can read more about it at +// https://doc.rust-lang.org/std/convert/trait.TryFrom.html +// +// Execute `rustlings hint try_from_into` or use the `hint` watch subcommand for +// a hint. use std::convert::{TryFrom, TryInto}; @@ -25,14 +29,13 @@ enum IntoColorError { // I AM NOT DONE -// Your task is to complete this implementation -// and return an Ok result of inner type Color. -// You need to create an implementation for a tuple of three integers, -// an array of three integers, and a slice of integers. +// Your task is to complete this implementation and return an Ok result of inner +// type Color. You need to create an implementation for a tuple of three +// integers, an array of three integers, and a slice of integers. // -// Note that the implementation for tuple and array will be checked at compile time, -// but the slice implementation needs to check the slice length! -// Also note that correct RGB color values must be integers in the 0..=255 range. +// Note that the implementation for tuple and array will be checked at compile +// time, but the slice implementation needs to check the slice length! Also note +// that correct RGB color values must be integers in the 0..=255 range. // Tuple implementation impl TryFrom<(i16, i16, i16)> for Color { diff --git a/exercises/conversions/using_as.rs b/exercises/conversions/using_as.rs index 8c9b7113..414cef3a 100644 --- a/exercises/conversions/using_as.rs +++ b/exercises/conversions/using_as.rs @@ -1,10 +1,14 @@ -// Type casting in Rust is done via the usage of the `as` operator. -// Please note that the `as` operator is not only used when type casting. -// It also helps with renaming imports. +// using_as.rs // -// The goal is to make sure that the division does not fail to compile -// and returns the proper type. -// Execute `rustlings hint using_as` or use the `hint` watch subcommand for a hint. +// Type casting in Rust is done via the usage of the `as` operator. Please note +// that the `as` operator is not only used when type casting. It also helps with +// renaming imports. +// +// The goal is to make sure that the division does not fail to compile and +// returns the proper type. +// +// Execute `rustlings hint using_as` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/enums/enums1.rs b/exercises/enums/enums1.rs index 511ba740..25525b25 100644 --- a/exercises/enums/enums1.rs +++ b/exercises/enums/enums1.rs @@ -1,4 +1,5 @@ // enums1.rs +// // No hints this time! ;) // I AM NOT DONE diff --git a/exercises/enums/enums2.rs b/exercises/enums/enums2.rs index 167a6b2e..df93fe0f 100644 --- a/exercises/enums/enums2.rs +++ b/exercises/enums/enums2.rs @@ -1,5 +1,7 @@ // enums2.rs -// Execute `rustlings hint enums2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint enums2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/enums/enums3.rs b/exercises/enums/enums3.rs index a2a9d586..69ba0728 100644 --- a/exercises/enums/enums3.rs +++ b/exercises/enums/enums3.rs @@ -1,6 +1,9 @@ // enums3.rs +// // Address all the TODOs to make the tests pass! -// Execute `rustlings hint enums3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint enums3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE @@ -37,8 +40,10 @@ impl State { } fn process(&mut self, message: Message) { - // TODO: create a match expression to process the different message variants - // Remember: When passing a tuple as a function argument, you'll need extra parentheses: fn function((t, u, p, l, e)) + // TODO: create a match expression to process the different message + // variants + // Remember: When passing a tuple as a function argument, you'll need + // extra parentheses: fn function((t, u, p, l, e)) } } diff --git a/exercises/error_handling/errors1.rs b/exercises/error_handling/errors1.rs index bcee9723..0ba59a57 100644 --- a/exercises/error_handling/errors1.rs +++ b/exercises/error_handling/errors1.rs @@ -1,9 +1,13 @@ // errors1.rs -// This function refuses to generate text to be printed on a nametag if -// you pass it an empty string. It'd be nicer if it explained what the problem -// was, instead of just sometimes returning `None`. Thankfully, Rust has a similar -// construct to `Option` that can be used to express error conditions. Let's use it! -// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a hint. +// +// This function refuses to generate text to be printed on a nametag if you pass +// it an empty string. It'd be nicer if it explained what the problem was, +// instead of just sometimes returning `None`. Thankfully, Rust has a similar +// construct to `Option` that can be used to express error conditions. Let's use +// it! +// +// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/error_handling/errors2.rs b/exercises/error_handling/errors2.rs index 6971fcfb..d86f326d 100644 --- a/exercises/error_handling/errors2.rs +++ b/exercises/error_handling/errors2.rs @@ -1,21 +1,23 @@ // errors2.rs +// // Say we're writing a game where you can buy items with tokens. All items cost // 5 tokens, and whenever you purchase items there is a processing fee of 1 -// token. A player of the game will type in how many items they want to buy, -// and the `total_cost` function will calculate the total cost of the tokens. -// Since the player typed in the quantity, though, we get it as a string-- and -// they might have typed anything, not just numbers! - +// token. A player of the game will type in how many items they want to buy, and +// the `total_cost` function will calculate the total cost of the tokens. Since +// the player typed in the quantity, though, we get it as a string-- and they +// might have typed anything, not just numbers! +// // Right now, this function isn't handling the error case at all (and isn't -// handling the success case properly either). What we want to do is: -// if we call the `parse` function on a string that is not a number, that -// function will return a `ParseIntError`, and in that case, we want to -// immediately return that error from our function and not try to multiply -// and add. - -// There are at least two ways to implement this that are both correct-- but -// one is a lot shorter! -// Execute `rustlings hint errors2` or use the `hint` watch subcommand for a hint. +// handling the success case properly either). What we want to do is: if we call +// the `parse` function on a string that is not a number, that function will +// return a `ParseIntError`, and in that case, we want to immediately return +// that error from our function and not try to multiply and add. +// +// There are at least two ways to implement this that are both correct-- but one +// is a lot shorter! +// +// Execute `rustlings hint errors2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/error_handling/errors3.rs b/exercises/error_handling/errors3.rs index a2d2d190..d42d3b17 100644 --- a/exercises/error_handling/errors3.rs +++ b/exercises/error_handling/errors3.rs @@ -1,8 +1,11 @@ // errors3.rs +// // This is a program that is trying to use a completed version of the // `total_cost` function from the previous exercise. It's not working though! // Why not? What should we do to fix it? -// Execute `rustlings hint errors3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint errors3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/error_handling/errors4.rs b/exercises/error_handling/errors4.rs index 0efe8ccd..e04bff77 100644 --- a/exercises/error_handling/errors4.rs +++ b/exercises/error_handling/errors4.rs @@ -1,5 +1,7 @@ // errors4.rs -// Execute `rustlings hint errors4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint errors4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/error_handling/errors5.rs b/exercises/error_handling/errors5.rs index eb5506cb..92461a7e 100644 --- a/exercises/error_handling/errors5.rs +++ b/exercises/error_handling/errors5.rs @@ -1,20 +1,26 @@ // errors5.rs - +// // This program uses an altered version of the code from errors4. - -// This exercise uses some concepts that we won't get to until later in the course, like `Box` and the -// `From` trait. It's not important to understand them in detail right now, but you can read ahead if you like. -// For now, think of the `Box` type as an "I want anything that does ???" type, which, given -// Rust's usual standards for runtime safety, should strike you as somewhat lenient! - -// In short, this particular use case for boxes is for when you want to own a value and you care only that it is a -// type which implements a particular trait. To do so, The Box is declared as of type Box where Trait is the trait -// the compiler looks for on any value used in that context. For this exercise, that context is the potential errors -// which can be returned in a Result. - -// What can we use to describe both errors? In other words, is there a trait which both errors implement? - -// Execute `rustlings hint errors5` or use the `hint` watch subcommand for a hint. +// +// This exercise uses some concepts that we won't get to until later in the +// course, like `Box` and the `From` trait. It's not important to understand +// them in detail right now, but you can read ahead if you like. For now, think +// of the `Box` type as an "I want anything that does ???" type, which, +// given Rust's usual standards for runtime safety, should strike you as +// somewhat lenient! +// +// In short, this particular use case for boxes is for when you want to own a +// value and you care only that it is a type which implements a particular +// trait. To do so, The Box is declared as of type Box where Trait is +// the trait the compiler looks for on any value used in that context. For this +// exercise, that context is the potential errors which can be returned in a +// Result. +// +// What can we use to describe both errors? In other words, is there a trait +// which both errors implement? +// +// Execute `rustlings hint errors5` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/error_handling/errors6.rs b/exercises/error_handling/errors6.rs index 8097b490..aaf0948e 100644 --- a/exercises/error_handling/errors6.rs +++ b/exercises/error_handling/errors6.rs @@ -1,12 +1,13 @@ // errors6.rs - +// // Using catch-all error types like `Box` isn't recommended // for library code, where callers might want to make decisions based on the -// error content, instead of printing it out or propagating it further. Here, -// we define a custom error type to make it possible for callers to decide -// what to do next when our function returns an error. - -// Execute `rustlings hint errors6` or use the `hint` watch subcommand for a hint. +// error content, instead of printing it out or propagating it further. Here, we +// define a custom error type to make it possible for callers to decide what to +// do next when our function returns an error. +// +// Execute `rustlings hint errors6` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/functions/functions1.rs b/exercises/functions/functions1.rs index 03d8af70..40ed9a07 100644 --- a/exercises/functions/functions1.rs +++ b/exercises/functions/functions1.rs @@ -1,5 +1,7 @@ // functions1.rs -// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/functions/functions2.rs b/exercises/functions/functions2.rs index 7d40a578..5154f34d 100644 --- a/exercises/functions/functions2.rs +++ b/exercises/functions/functions2.rs @@ -1,5 +1,7 @@ // functions2.rs -// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/functions/functions3.rs b/exercises/functions/functions3.rs index 3b9e585b..74f44d6d 100644 --- a/exercises/functions/functions3.rs +++ b/exercises/functions/functions3.rs @@ -1,5 +1,7 @@ // functions3.rs -// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/functions/functions4.rs b/exercises/functions/functions4.rs index 65d5be4f..77c4b2aa 100644 --- a/exercises/functions/functions4.rs +++ b/exercises/functions/functions4.rs @@ -1,11 +1,12 @@ // functions4.rs -// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a hint. - -// This store is having a sale where if the price is an even number, you get -// 10 Rustbucks off, but if it's an odd number, it's 3 Rustbucks off. -// (Don't worry about the function bodies themselves, we're only interested -// in the signatures for now. If anything, this is a good way to peek ahead -// to future exercises!) +// +// This store is having a sale where if the price is an even number, you get 10 +// Rustbucks off, but if it's an odd number, it's 3 Rustbucks off. (Don't worry +// about the function bodies themselves, we're only interested in the signatures +// for now. If anything, this is a good way to peek ahead to future exercises!) +// +// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/functions/functions5.rs b/exercises/functions/functions5.rs index 5d762961..f1b63f48 100644 --- a/exercises/functions/functions5.rs +++ b/exercises/functions/functions5.rs @@ -1,5 +1,7 @@ // functions5.rs -// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/generics/generics1.rs b/exercises/generics/generics1.rs index 4c34ae47..35c1d2fe 100644 --- a/exercises/generics/generics1.rs +++ b/exercises/generics/generics1.rs @@ -1,7 +1,10 @@ -// This shopping list program isn't compiling! -// Use your knowledge of generics to fix it. - -// Execute `rustlings hint generics1` or use the `hint` watch subcommand for a hint. +// generics1.rs +// +// This shopping list program isn't compiling! Use your knowledge of generics to +// fix it. +// +// Execute `rustlings hint generics1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/generics/generics2.rs b/exercises/generics/generics2.rs index aedbd55c..074cd938 100644 --- a/exercises/generics/generics2.rs +++ b/exercises/generics/generics2.rs @@ -1,7 +1,10 @@ +// generics2.rs +// // This powerful wrapper provides the ability to store a positive integer value. // Rewrite it using generics so that it supports wrapping ANY type. - -// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/hashmaps/hashmaps1.rs b/exercises/hashmaps/hashmaps1.rs index fd8dd2f8..80829eaa 100644 --- a/exercises/hashmaps/hashmaps1.rs +++ b/exercises/hashmaps/hashmaps1.rs @@ -1,14 +1,15 @@ // hashmaps1.rs -// A basket of fruits in the form of a hash map needs to be defined. -// The key represents the name of the fruit and the value represents -// how many of that particular fruit is in the basket. You have to put -// at least three different types of fruits (e.g apple, banana, mango) -// in the basket and the total count of all the fruits should be at -// least five. +// +// A basket of fruits in the form of a hash map needs to be defined. The key +// represents the name of the fruit and the value represents how many of that +// particular fruit is in the basket. You have to put at least three different +// types of fruits (e.g apple, banana, mango) in the basket and the total count +// of all the fruits should be at least five. // // Make me compile and pass the tests! // -// Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/hashmaps/hashmaps2.rs b/exercises/hashmaps/hashmaps2.rs index a4f069a8..f9138486 100644 --- a/exercises/hashmaps/hashmaps2.rs +++ b/exercises/hashmaps/hashmaps2.rs @@ -1,17 +1,18 @@ // hashmaps2.rs -// We're collecting different fruits to bake a delicious fruit cake. -// For this, we have a basket, which we'll represent in the form of a hash -// map. The key represents the name of each fruit we collect and the value -// represents how many of that particular fruit we have collected. -// Three types of fruits - Apple (4), Mango (2) and Lychee (5) are already -// in the basket hash map. -// You must add fruit to the basket so that there is at least -// one of each kind and more than 11 in total - we have a lot of mouths to feed. -// You are not allowed to insert any more of these fruits! +// +// We're collecting different fruits to bake a delicious fruit cake. For this, +// we have a basket, which we'll represent in the form of a hash map. The key +// represents the name of each fruit we collect and the value represents how +// many of that particular fruit we have collected. Three types of fruits - +// Apple (4), Mango (2) and Lychee (5) are already in the basket hash map. You +// must add fruit to the basket so that there is at least one of each kind and +// more than 11 in total - we have a lot of mouths to feed. You are not allowed +// to insert any more of these fruits! // // Make me pass the tests! // -// Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE @@ -36,9 +37,9 @@ fn fruit_basket(basket: &mut HashMap) { ]; for fruit in fruit_kinds { - // TODO: Insert new fruits if they are not already present in the basket. - // Note that you are not allowed to put any type of fruit that's already - // present! + // TODO: Insert new fruits if they are not already present in the + // basket. Note that you are not allowed to put any type of fruit that's + // already present! } } diff --git a/exercises/hashmaps/hashmaps3.rs b/exercises/hashmaps/hashmaps3.rs index ad3baa68..4b48e093 100644 --- a/exercises/hashmaps/hashmaps3.rs +++ b/exercises/hashmaps/hashmaps3.rs @@ -1,18 +1,18 @@ // hashmaps3.rs - -// A list of scores (one per line) of a soccer match is given. Each line -// is of the form : -// ,,, +// +// A list of scores (one per line) of a soccer match is given. Each line is of +// the form : ",,," // Example: England,France,4,2 (England scored 4 goals, France 2). - -// You have to build a scores table containing the name of the team, goals -// the team scored, and goals the team conceded. One approach to build -// the scores table is to use a Hashmap. The solution is partially -// written to use a Hashmap, complete it to pass the test. - +// +// You have to build a scores table containing the name of the team, goals the +// team scored, and goals the team conceded. One approach to build the scores +// table is to use a Hashmap. The solution is partially written to use a +// Hashmap, complete it to pass the test. +// // Make me pass the tests! - -// Execute `rustlings hint hashmaps3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint hashmaps3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/if/if1.rs b/exercises/if/if1.rs index 587e03f8..d8108a0f 100644 --- a/exercises/if/if1.rs +++ b/exercises/if/if1.rs @@ -1,4 +1,5 @@ // if1.rs +// // Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/if/if2.rs b/exercises/if/if2.rs index effddbb6..f512f13f 100644 --- a/exercises/if/if2.rs +++ b/exercises/if/if2.rs @@ -1,7 +1,8 @@ // if2.rs - +// // Step 1: Make me compile! // Step 2: Get the bar_for_fuzz and default_to_baz tests passing! +// // Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/intro/intro1.rs b/exercises/intro/intro1.rs index cfc55c30..37fa0112 100644 --- a/exercises/intro/intro1.rs +++ b/exercises/intro/intro1.rs @@ -1,13 +1,17 @@ // intro1.rs +// // About this `I AM NOT DONE` thing: // We sometimes encourage you to keep trying things on a given exercise, even // after you already figured it out. If you got everything working and feel // ready for the next exercise, remove the `I AM NOT DONE` comment below. -// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a hint. // -// If you're running this using `rustlings watch`: The exercise file will be reloaded -// when you change one of the lines below! Try adding a `println!` line, or try changing -// what it outputs in your terminal. Try removing a semicolon and see what happens! +// If you're running this using `rustlings watch`: The exercise file will be +// reloaded when you change one of the lines below! Try adding a `println!` +// line, or try changing what it outputs in your terminal. Try removing a +// semicolon and see what happens! +// +// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/intro/intro2.rs b/exercises/intro/intro2.rs index efc1af20..990b20f0 100644 --- a/exercises/intro/intro2.rs +++ b/exercises/intro/intro2.rs @@ -1,6 +1,9 @@ // intro2.rs +// // Make the code print a greeting to the world. -// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/iterators/iterators1.rs b/exercises/iterators/iterators1.rs index f9cc3b39..b3f698be 100644 --- a/exercises/iterators/iterators1.rs +++ b/exercises/iterators/iterators1.rs @@ -1,12 +1,13 @@ // iterators1.rs // -// Make me compile by filling in the `???`s +// When performing operations on elements within a collection, iterators are +// essential. This module helps you get familiar with the structure of using an +// iterator and how to go through elements within an iterable collection. // -// When performing operations on elements within a collection, iterators are essential. -// This module helps you get familiar with the structure of using an iterator and -// how to go through elements within an iterable collection. +// Make me compile by filling in the `???`s // -// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/iterators/iterators2.rs b/exercises/iterators/iterators2.rs index 29c53afb..dda82a08 100644 --- a/exercises/iterators/iterators2.rs +++ b/exercises/iterators/iterators2.rs @@ -1,7 +1,10 @@ // iterators2.rs +// // In this exercise, you'll learn some of the unique advantages that iterators // can offer. Follow the steps to complete the exercise. -// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/iterators/iterators3.rs b/exercises/iterators/iterators3.rs index c97a6258..29fa23a3 100644 --- a/exercises/iterators/iterators3.rs +++ b/exercises/iterators/iterators3.rs @@ -1,10 +1,13 @@ // iterators3.rs -// This is a bigger exercise than most of the others! You can do it! -// Here is your mission, should you choose to accept it: +// +// This is a bigger exercise than most of the others! You can do it! Here is +// your mission, should you choose to accept it: // 1. Complete the divide function to get the first four tests to pass. // 2. Get the remaining tests to pass by completing the result_with_list and // list_of_results functions. -// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE @@ -26,14 +29,16 @@ pub fn divide(a: i32, b: i32) -> Result { todo!(); } -// Complete the function and return a value of the correct type so the test passes. +// Complete the function and return a value of the correct type so the test +// passes. // Desired output: Ok([1, 11, 1426, 3]) fn result_with_list() -> () { let numbers = vec![27, 297, 38502, 81]; let division_results = numbers.into_iter().map(|n| divide(n, 27)); } -// Complete the function and return a value of the correct type so the test passes. +// Complete the function and return a value of the correct type so the test +// passes. // Desired output: [Ok(1), Ok(11), Ok(1426), Ok(3)] fn list_of_results() -> () { let numbers = vec![27, 297, 38502, 81]; diff --git a/exercises/iterators/iterators4.rs b/exercises/iterators/iterators4.rs index a02470ec..79e1692b 100644 --- a/exercises/iterators/iterators4.rs +++ b/exercises/iterators/iterators4.rs @@ -1,5 +1,7 @@ // iterators4.rs -// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/iterators/iterators5.rs b/exercises/iterators/iterators5.rs index d0fcc8ca..a062ee4c 100644 --- a/exercises/iterators/iterators5.rs +++ b/exercises/iterators/iterators5.rs @@ -1,4 +1,5 @@ // iterators5.rs +// // Let's define a simple model to track Rustlings exercise progress. Progress // will be modelled using a hash map. The name of the exercise is the key and // the progress is the value. Two counting functions were created to count the @@ -6,7 +7,9 @@ // functionality using iterators. Try not to use imperative loops (for, while). // Only the two iterator methods (count_iterator and count_collection_iterator) // need to be modified. -// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/lifetimes/lifetimes1.rs b/exercises/lifetimes/lifetimes1.rs index 0236470d..87bde490 100644 --- a/exercises/lifetimes/lifetimes1.rs +++ b/exercises/lifetimes/lifetimes1.rs @@ -1,11 +1,12 @@ // lifetimes1.rs // // The Rust compiler needs to know how to check whether supplied references are -// valid, so that it can let the programmer know if a reference is at risk -// of going out of scope before it is used. Remember, references are borrows -// and do not own their own data. What if their owner goes out of scope? +// valid, so that it can let the programmer know if a reference is at risk of +// going out of scope before it is used. Remember, references are borrows and do +// not own their own data. What if their owner goes out of scope? // -// Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/lifetimes/lifetimes2.rs b/exercises/lifetimes/lifetimes2.rs index b48feabc..4f3d8c18 100644 --- a/exercises/lifetimes/lifetimes2.rs +++ b/exercises/lifetimes/lifetimes2.rs @@ -1,10 +1,10 @@ // lifetimes2.rs // -// So if the compiler is just validating the references passed -// to the annotated parameters and the return type, what do -// we need to change? +// So if the compiler is just validating the references passed to the annotated +// parameters and the return type, what do we need to change? // -// Execute `rustlings hint lifetimes2` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint lifetimes2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/lifetimes/lifetimes3.rs b/exercises/lifetimes/lifetimes3.rs index ea483708..9c59f9c0 100644 --- a/exercises/lifetimes/lifetimes3.rs +++ b/exercises/lifetimes/lifetimes3.rs @@ -2,7 +2,8 @@ // // Lifetimes are also needed when structs hold references. // -// Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/macros/macros1.rs b/exercises/macros/macros1.rs index 634d0a70..678de6ee 100644 --- a/exercises/macros/macros1.rs +++ b/exercises/macros/macros1.rs @@ -1,5 +1,7 @@ // macros1.rs -// Execute `rustlings hint macros1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint macros1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/macros/macros2.rs b/exercises/macros/macros2.rs index f6092cab..788fc16a 100644 --- a/exercises/macros/macros2.rs +++ b/exercises/macros/macros2.rs @@ -1,5 +1,7 @@ // macros2.rs -// Execute `rustlings hint macros2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint macros2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/macros/macros3.rs b/exercises/macros/macros3.rs index 106f1c6d..b795c149 100644 --- a/exercises/macros/macros3.rs +++ b/exercises/macros/macros3.rs @@ -1,6 +1,9 @@ // macros3.rs +// // Make me compile, without taking the macro out of the module! -// Execute `rustlings hint macros3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint macros3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/macros/macros4.rs b/exercises/macros/macros4.rs index 4ee98035..71b45a09 100644 --- a/exercises/macros/macros4.rs +++ b/exercises/macros/macros4.rs @@ -1,5 +1,7 @@ // macros4.rs -// Execute `rustlings hint macros4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint macros4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/modules/modules1.rs b/exercises/modules/modules1.rs index 8dd0e402..9eb5a48b 100644 --- a/exercises/modules/modules1.rs +++ b/exercises/modules/modules1.rs @@ -1,5 +1,7 @@ // modules1.rs -// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/modules/modules2.rs b/exercises/modules/modules2.rs index c30a3897..04154543 100644 --- a/exercises/modules/modules2.rs +++ b/exercises/modules/modules2.rs @@ -1,7 +1,11 @@ // modules2.rs -// You can bring module paths into scopes and provide new names for them with the -// 'use' and 'as' keywords. Fix these 'use' statements to make the code compile. -// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a hint. +// +// You can bring module paths into scopes and provide new names for them with +// the 'use' and 'as' keywords. Fix these 'use' statements to make the code +// compile. +// +// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/modules/modules3.rs b/exercises/modules/modules3.rs index 35e07990..f2bb0503 100644 --- a/exercises/modules/modules3.rs +++ b/exercises/modules/modules3.rs @@ -1,9 +1,12 @@ // modules3.rs -// You can use the 'use' keyword to bring module paths from modules from anywhere -// and especially from the Rust standard library into your scope. -// Bring SystemTime and UNIX_EPOCH -// from the std::time module. Bonus style points if you can do it with one line! -// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a hint. +// +// You can use the 'use' keyword to bring module paths from modules from +// anywhere and especially from the Rust standard library into your scope. Bring +// SystemTime and UNIX_EPOCH from the std::time module. Bonus style points if +// you can do it with one line! +// +// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics1.rs b/exercises/move_semantics/move_semantics1.rs index aac6dfc3..710d20d8 100644 --- a/exercises/move_semantics/move_semantics1.rs +++ b/exercises/move_semantics/move_semantics1.rs @@ -1,5 +1,7 @@ // move_semantics1.rs -// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics2.rs b/exercises/move_semantics/move_semantics2.rs index 93bb82ef..5821b52b 100644 --- a/exercises/move_semantics/move_semantics2.rs +++ b/exercises/move_semantics/move_semantics2.rs @@ -1,9 +1,11 @@ // move_semantics2.rs -// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand for a hint. - +// // Expected output: // vec0 has length 3 content `[22, 44, 66]` // vec1 has length 4 content `[22, 44, 66, 88]` +// +// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics3.rs b/exercises/move_semantics/move_semantics3.rs index eaa30e33..ea214934 100644 --- a/exercises/move_semantics/move_semantics3.rs +++ b/exercises/move_semantics/move_semantics3.rs @@ -1,7 +1,10 @@ // move_semantics3.rs -// Make me compile without adding new lines-- just changing existing lines! -// (no lines with multiple semicolons necessary!) -// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand for a hint. +// +// Make me compile without adding new lines-- just changing existing lines! (no +// lines with multiple semicolons necessary!) +// +// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics4.rs b/exercises/move_semantics/move_semantics4.rs index 99834ec3..75a3b6bd 100644 --- a/exercises/move_semantics/move_semantics4.rs +++ b/exercises/move_semantics/move_semantics4.rs @@ -1,8 +1,11 @@ // move_semantics4.rs -// Refactor this code so that instead of passing `vec0` into the `fill_vec` function, -// the Vector gets created in the function itself and passed back to the main -// function. -// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand for a hint. +// +// Refactor this code so that instead of passing `vec0` into the `fill_vec` +// function, the Vector gets created in the function itself and passed back to +// the main function. +// +// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics5.rs b/exercises/move_semantics/move_semantics5.rs index 36eae127..68db09eb 100644 --- a/exercises/move_semantics/move_semantics5.rs +++ b/exercises/move_semantics/move_semantics5.rs @@ -1,7 +1,10 @@ // move_semantics5.rs -// Make me compile only by reordering the lines in `main()`, but without -// adding, changing or removing any of them. -// Execute `rustlings hint move_semantics5` or use the `hint` watch subcommand for a hint. +// +// Make me compile only by reordering the lines in `main()`, but without adding, +// changing or removing any of them. +// +// Execute `rustlings hint move_semantics5` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/move_semantics/move_semantics6.rs b/exercises/move_semantics/move_semantics6.rs index eb52a848..cace4ca6 100644 --- a/exercises/move_semantics/move_semantics6.rs +++ b/exercises/move_semantics/move_semantics6.rs @@ -1,6 +1,9 @@ // move_semantics6.rs -// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand for a hint. +// // You can't change anything except adding or removing references. +// +// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/options/options1.rs b/exercises/options/options1.rs index 1f891b0e..e131b48b 100644 --- a/exercises/options/options1.rs +++ b/exercises/options/options1.rs @@ -1,5 +1,7 @@ // options1.rs -// Execute `rustlings hint options1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint options1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE @@ -7,8 +9,9 @@ // If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them // all, so there'll be no more left :( fn maybe_icecream(time_of_day: u16) -> Option { - // We use the 24-hour system here, so 10PM is a value of 22 and 12AM is a value of 0 - // The Option output should gracefully handle cases where time_of_day > 23. + // We use the 24-hour system here, so 10PM is a value of 22 and 12AM is a + // value of 0 The Option output should gracefully handle cases where + // time_of_day > 23. // TODO: Complete the function body - remember to return an Option! ??? } @@ -28,7 +31,8 @@ mod tests { #[test] fn raw_value() { - // TODO: Fix this test. How do you get at the value contained in the Option? + // TODO: Fix this test. How do you get at the value contained in the + // Option? let icecreams = maybe_icecream(12); assert_eq!(icecreams, 5); } diff --git a/exercises/options/options2.rs b/exercises/options/options2.rs index 337c4261..4d998e7d 100644 --- a/exercises/options/options2.rs +++ b/exercises/options/options2.rs @@ -1,5 +1,7 @@ // options2.rs -// Execute `rustlings hint options2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint options2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE @@ -27,8 +29,9 @@ mod tests { let mut cursor = range; - // TODO: make this a while let statement - remember that vector.pop also adds another layer of Option - // You can stack `Option`s into while let and if let + // TODO: make this a while let statement - remember that vector.pop also + // adds another layer of Option. You can stack `Option`s into + // while let and if let. integer = optional_integers.pop() { assert_eq!(integer, cursor); cursor -= 1; diff --git a/exercises/options/options3.rs b/exercises/options/options3.rs index 3ed76eeb..23c15eab 100644 --- a/exercises/options/options3.rs +++ b/exercises/options/options3.rs @@ -1,5 +1,7 @@ // options3.rs -// Execute `rustlings hint options3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint options3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/primitive_types/primitive_types1.rs b/exercises/primitive_types/primitive_types1.rs index 09121392..e1cf52a2 100644 --- a/exercises/primitive_types/primitive_types1.rs +++ b/exercises/primitive_types/primitive_types1.rs @@ -1,6 +1,10 @@ // primitive_types1.rs -// Fill in the rest of the line that has code missing! -// No hints, there's no tricks, just get used to typing these :) +// +// Fill in the rest of the line that has code missing! No hints, there's no +// tricks, just get used to typing these :) +// +// Execute `rustlings hint primitive_types1` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/primitive_types/primitive_types2.rs b/exercises/primitive_types/primitive_types2.rs index 8730baab..fcc9705a 100644 --- a/exercises/primitive_types/primitive_types2.rs +++ b/exercises/primitive_types/primitive_types2.rs @@ -1,6 +1,10 @@ // primitive_types2.rs -// Fill in the rest of the line that has code missing! -// No hints, there's no tricks, just get used to typing these :) +// +// Fill in the rest of the line that has code missing! No hints, there's no +// tricks, just get used to typing these :) +// +// Execute `rustlings hint primitive_types2` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/primitive_types/primitive_types3.rs b/exercises/primitive_types/primitive_types3.rs index fa7d019a..06a7a621 100644 --- a/exercises/primitive_types/primitive_types3.rs +++ b/exercises/primitive_types/primitive_types3.rs @@ -1,6 +1,9 @@ // primitive_types3.rs +// // Create an array with at least 100 elements in it where the ??? is. -// Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/primitive_types/primitive_types4.rs b/exercises/primitive_types/primitive_types4.rs index 71fa243c..d44d8776 100644 --- a/exercises/primitive_types/primitive_types4.rs +++ b/exercises/primitive_types/primitive_types4.rs @@ -1,6 +1,9 @@ // primitive_types4.rs +// // Get a slice out of Array a where the ??? is so that the test passes. -// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/primitive_types/primitive_types5.rs b/exercises/primitive_types/primitive_types5.rs index 4fd9141f..f646986e 100644 --- a/exercises/primitive_types/primitive_types5.rs +++ b/exercises/primitive_types/primitive_types5.rs @@ -1,6 +1,9 @@ // primitive_types5.rs +// // Destructure the `cat` tuple so that the println will work. -// Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/primitive_types/primitive_types6.rs b/exercises/primitive_types/primitive_types6.rs index ddf8b423..07cc46c6 100644 --- a/exercises/primitive_types/primitive_types6.rs +++ b/exercises/primitive_types/primitive_types6.rs @@ -1,7 +1,10 @@ // primitive_types6.rs -// Use a tuple index to access the second element of `numbers`. -// You can put the expression for the second element where ??? is so that the test passes. -// Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand for a hint. +// +// Use a tuple index to access the second element of `numbers`. You can put the +// expression for the second element where ??? is so that the test passes. +// +// Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand +// for a hint. // I AM NOT DONE diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index dbb5cdc9..a9904b8b 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -1,14 +1,17 @@ // quiz1.rs +// // This is a quiz for the following sections: // - Variables // - Functions // - If - +// // Mary is buying apples. The price of an apple is calculated as follows: // - An apple costs 2 rustbucks. // - If Mary buys more than 40 apples, each apple only costs 1 rustbuck! -// Write a function that calculates the price of an order of apples given -// the quantity bought. No hints this time! +// Write a function that calculates the price of an order of apples given the +// quantity bought. No hints this time! +// +// No hints this time ;) // I AM NOT DONE diff --git a/exercises/quiz2.rs b/exercises/quiz2.rs index 5c42dae0..29925caf 100644 --- a/exercises/quiz2.rs +++ b/exercises/quiz2.rs @@ -1,14 +1,15 @@ // quiz2.rs +// // This is a quiz for the following sections: // - Strings // - Vecs // - Move semantics // - Modules // - Enums - -// Let's build a little machine in the form of a function. -// As input, we're going to give a list of strings and commands. These commands -// determine what action is going to be applied to the string. It can either be: +// +// Let's build a little machine in the form of a function. As input, we're going +// to give a list of strings and commands. These commands determine what action +// is going to be applied to the string. It can either be: // - Uppercase the string // - Trim the string // - Append "bar" to the string a specified amount of times @@ -16,6 +17,7 @@ // - The input is going to be a Vector of a 2-length tuple, // the first element is the string, the second one is the command. // - The output element is going to be a Vector of strings. +// // No hints this time! // I AM NOT DONE diff --git a/exercises/quiz3.rs b/exercises/quiz3.rs index 15dc4699..3b01d313 100644 --- a/exercises/quiz3.rs +++ b/exercises/quiz3.rs @@ -1,17 +1,19 @@ // quiz3.rs +// // This quiz tests: // - Generics // - Traits -// An imaginary magical school has a new report card generation system written in Rust! -// Currently the system only supports creating report cards where the student's grade -// is represented numerically (e.g. 1.0 -> 5.5). -// However, the school also issues alphabetical grades (A+ -> F-) and needs -// to be able to print both types of report card! - +// +// An imaginary magical school has a new report card generation system written +// in Rust! Currently the system only supports creating report cards where the +// student's grade is represented numerically (e.g. 1.0 -> 5.5). 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+" -// to show that your changes allow alphabetical grades. - +// 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 quiz3` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/smart_pointers/arc1.rs b/exercises/smart_pointers/arc1.rs index ffb306af..3526ddcb 100644 --- a/exercises/smart_pointers/arc1.rs +++ b/exercises/smart_pointers/arc1.rs @@ -1,21 +1,24 @@ // arc1.rs -// In this exercise, we are given a Vec of u32 called "numbers" with values ranging -// from 0 to 99 -- [ 0, 1, 2, ..., 98, 99 ] -// We would like to use this set of numbers within 8 different threads simultaneously. -// Each thread is going to get the sum of every eighth value, with an offset. +// +// In this exercise, we are given a Vec of u32 called "numbers" with values +// ranging from 0 to 99 -- [ 0, 1, 2, ..., 98, 99 ] We would like to use this +// set of numbers within 8 different threads simultaneously. Each thread is +// going to get the sum of every eighth value, with an offset. +// // The first thread (offset 0), will sum 0, 8, 16, ... // The second thread (offset 1), will sum 1, 9, 17, ... // The third thread (offset 2), will sum 2, 10, 18, ... // ... // The eighth thread (offset 7), will sum 7, 15, 23, ... - +// // Because we are using threads, our values need to be thread-safe. Therefore, // we are using Arc. We need to make a change in each of the two TODOs. - - +// // Make this code compile by filling in a value for `shared_numbers` where the // first TODO comment is, and create an initial binding for `child_numbers` -// where the second TODO comment is. Try not to create any copies of the `numbers` Vec! +// where the second TODO comment is. Try not to create any copies of the +// `numbers` Vec! +// // Execute `rustlings hint arc1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/smart_pointers/box1.rs b/exercises/smart_pointers/box1.rs index 66cf00f3..513e7daa 100644 --- a/exercises/smart_pointers/box1.rs +++ b/exercises/smart_pointers/box1.rs @@ -1,13 +1,15 @@ // box1.rs // -// At compile time, Rust needs to know how much space a type takes up. This becomes problematic -// for recursive types, where a value can have as part of itself another value of the same type. -// To get around the issue, we can use a `Box` - a smart pointer used to store data on the heap, -// which also allows us to wrap a recursive type. +// At compile time, Rust needs to know how much space a type takes up. This +// becomes problematic for recursive types, where a value can have as part of +// itself another value of the same type. To get around the issue, we can use a +// `Box` - a smart pointer used to store data on the heap, which also allows us +// to wrap a recursive type. // -// The recursive type we're implementing in this exercise is the `cons list` - a data structure -// frequently found in functional programming languages. Each item in a cons list contains two -// elements: the value of the current item and the next item. The last item is a value called `Nil`. +// The recursive type we're implementing in this exercise is the `cons list` - a +// data structure frequently found in functional programming languages. Each +// item in a cons list contains two elements: the value of the current item and +// the next item. The last item is a value called `Nil`. // // Step 1: use a `Box` in the enum definition to make the code compile // Step 2: create both empty and non-empty cons lists by replacing `todo!()` diff --git a/exercises/smart_pointers/cow1.rs b/exercises/smart_pointers/cow1.rs index bc5b28e5..7ca91686 100644 --- a/exercises/smart_pointers/cow1.rs +++ b/exercises/smart_pointers/cow1.rs @@ -1,12 +1,16 @@ // cow1.rs - -// This exercise explores the Cow, or Clone-On-Write type. -// Cow is a clone-on-write smart pointer. -// It can enclose and provide immutable access to borrowed data, and clone the data lazily when mutation or ownership is required. -// The type is designed to work with general borrowed data via the Borrow trait. +// +// This exercise explores the Cow, or Clone-On-Write type. Cow is a +// clone-on-write smart pointer. It can enclose and provide immutable access to +// borrowed data, and clone the data lazily when mutation or ownership is +// required. The type is designed to work with general borrowed data via the +// Borrow trait. // // This exercise is meant to show you what to expect when passing data to Cow. -// Fix the unit tests by checking for Cow::Owned(_) and Cow::Borrowed(_) at the TODO markers. +// Fix the unit tests by checking for Cow::Owned(_) and Cow::Borrowed(_) at the +// TODO markers. +// +// Execute `rustlings hint cow1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE @@ -50,10 +54,9 @@ mod tests { #[test] fn owned_no_mutation() -> Result<(), &'static str> { - // We can also pass `slice` without `&` so Cow owns it directly. - // In this case no mutation occurs and thus also no clone, - // but the result is still owned because it was never borrowed - // or mutated. + // We can also pass `slice` without `&` so Cow owns it directly. In this + // case no mutation occurs and thus also no clone, but the result is + // still owned because it was never borrowed or mutated. let slice = vec![0, 1, 2]; let mut input = Cow::from(slice); match abs_all(&mut input) { @@ -63,9 +66,9 @@ mod tests { #[test] fn owned_mutation() -> Result<(), &'static str> { - // Of course this is also the case if a mutation does occur. - // In this case the call to `to_mut()` returns a reference to - // the same data as before. + // Of course this is also the case if a mutation does occur. In this + // case the call to `to_mut()` returns a reference to the same data as + // before. let slice = vec![-1, 0, 1]; let mut input = Cow::from(slice); match abs_all(&mut input) { diff --git a/exercises/smart_pointers/rc1.rs b/exercises/smart_pointers/rc1.rs index d62f3619..ad3f1ce2 100644 --- a/exercises/smart_pointers/rc1.rs +++ b/exercises/smart_pointers/rc1.rs @@ -1,9 +1,14 @@ // rc1.rs -// In this exercise, we want to express the concept of multiple owners via the Rc type. -// This is a model of our solar system - there is a Sun type and multiple Planets. -// The Planets take ownership of the sun, indicating that they revolve around the sun. - -// Make this code compile by using the proper Rc primitives to express that the sun has multiple owners. +// +// In this exercise, we want to express the concept of multiple owners via the +// Rc type. This is a model of our solar system - there is a Sun type and +// multiple Planets. The Planets take ownership of the sun, indicating that they +// revolve around the sun. +// +// Make this code compile by using the proper Rc primitives to express that the +// sun has multiple owners. +// +// Execute `rustlings hint rc1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/strings/strings1.rs b/exercises/strings/strings1.rs index 0de86a1d..f50e1fa9 100644 --- a/exercises/strings/strings1.rs +++ b/exercises/strings/strings1.rs @@ -1,6 +1,9 @@ // strings1.rs +// // Make me compile without changing the function signature! -// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/strings/strings2.rs b/exercises/strings/strings2.rs index 0c48ec95..4d95d16a 100644 --- a/exercises/strings/strings2.rs +++ b/exercises/strings/strings2.rs @@ -1,6 +1,9 @@ // strings2.rs +// // Make me compile without changing the function signature! -// Execute `rustlings hint strings2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint strings2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/strings/strings3.rs b/exercises/strings/strings3.rs index e2353aec..b29f9325 100644 --- a/exercises/strings/strings3.rs +++ b/exercises/strings/strings3.rs @@ -1,5 +1,7 @@ // strings3.rs -// Execute `rustlings hint strings3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint strings3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/strings/strings4.rs b/exercises/strings/strings4.rs index c410b562..e8c54acc 100644 --- a/exercises/strings/strings4.rs +++ b/exercises/strings/strings4.rs @@ -1,9 +1,10 @@ // strings4.rs - +// // Ok, here are a bunch of values-- some are `String`s, some are `&str`s. Your // task is to call one of these two functions on each value depending on what // you think each value is. That is, add either `string_slice` or `string` // before the parentheses on each line. If you're right, it will compile! +// // No hints this time! // I AM NOT DONE diff --git a/exercises/structs/structs1.rs b/exercises/structs/structs1.rs index 0d91c469..5fa5821c 100644 --- a/exercises/structs/structs1.rs +++ b/exercises/structs/structs1.rs @@ -1,6 +1,9 @@ // structs1.rs +// // Address all the TODOs to make the tests pass! -// Execute `rustlings hint structs1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint structs1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/structs/structs2.rs b/exercises/structs/structs2.rs index 32e311fa..328567f0 100644 --- a/exercises/structs/structs2.rs +++ b/exercises/structs/structs2.rs @@ -1,6 +1,9 @@ // structs2.rs +// // Address all the TODOs to make the tests pass! -// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/structs/structs3.rs b/exercises/structs/structs3.rs index 3536a457..4851317c 100644 --- a/exercises/structs/structs3.rs +++ b/exercises/structs/structs3.rs @@ -1,8 +1,11 @@ // structs3.rs +// // Structs contain data, but can also have logic. In this exercise we have // defined the Package struct and we want to test some logic attached to it. // Make the code compile and the tests pass! -// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/tests/tests1.rs b/exercises/tests/tests1.rs index 8b6ea374..810277ac 100644 --- a/exercises/tests/tests1.rs +++ b/exercises/tests/tests1.rs @@ -1,11 +1,14 @@ // tests1.rs -// Tests are important to ensure that your code does what you think it should do. -// Tests can be run on this file with the following command: -// rustlings run tests1 - -// This test has a problem with it -- make the test compile! Make the test -// pass! Make the test fail! -// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a hint. +// +// Tests are important to ensure that your code does what you think it should +// do. Tests can be run on this file with the following command: rustlings run +// tests1 +// +// This test has a problem with it -- make the test compile! Make the test pass! +// Make the test fail! +// +// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/tests/tests2.rs b/exercises/tests/tests2.rs index a5ac15b1..f8024e9f 100644 --- a/exercises/tests/tests2.rs +++ b/exercises/tests/tests2.rs @@ -1,7 +1,10 @@ // tests2.rs -// This test has a problem with it -- make the test compile! Make the test -// pass! Make the test fail! -// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a hint. +// +// This test has a problem with it -- make the test compile! Make the test pass! +// Make the test fail! +// +// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/tests/tests3.rs b/exercises/tests/tests3.rs index 196a81a0..4013e384 100644 --- a/exercises/tests/tests3.rs +++ b/exercises/tests/tests3.rs @@ -1,8 +1,11 @@ // tests3.rs +// // This test isn't testing our function -- make it do that in such a way that -// the test passes. Then write a second test that tests whether we get the result -// we expect to get when we call `is_even(5)`. -// Execute `rustlings hint tests3` or use the `hint` watch subcommand for a hint. +// the test passes. Then write a second test that tests whether we get the +// result we expect to get when we call `is_even(5)`. +// +// Execute `rustlings hint tests3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/tests/tests4.rs b/exercises/tests/tests4.rs index 1f34a2b2..935d0db1 100644 --- a/exercises/tests/tests4.rs +++ b/exercises/tests/tests4.rs @@ -1,6 +1,9 @@ // tests4.rs +// // Make sure that we're testing for the correct conditions! -// Execute `rustlings hint tests4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint tests4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/threads/threads1.rs b/exercises/threads/threads1.rs index ae124eeb..80b6def3 100644 --- a/exercises/threads/threads1.rs +++ b/exercises/threads/threads1.rs @@ -1,10 +1,12 @@ // threads1.rs -// Execute `rustlings hint threads1` or use the `hint` watch subcommand for a hint. - -// This program spawns multiple threads that each run for at least 250ms, -// and each thread returns how much time they took to complete. -// The program should wait until all the spawned threads have finished and -// should collect their return values into a vector. +// +// This program spawns multiple threads that each run for at least 250ms, and +// each thread returns how much time they took to complete. The program should +// wait until all the spawned threads have finished and should collect their +// return values into a vector. +// +// Execute `rustlings hint threads1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/threads/threads2.rs b/exercises/threads/threads2.rs index ada3d14a..62dad80d 100644 --- a/exercises/threads/threads2.rs +++ b/exercises/threads/threads2.rs @@ -1,7 +1,11 @@ // threads2.rs -// Execute `rustlings hint threads2` or use the `hint` watch subcommand for a hint. -// Building on the last exercise, we want all of the threads to complete their work but this time -// the spawned threads need to be in charge of updating a shared value: JobStatus.jobs_completed +// +// Building on the last exercise, we want all of the threads to complete their +// work but this time the spawned threads need to be in charge of updating a +// shared value: JobStatus.jobs_completed +// +// Execute `rustlings hint threads2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE @@ -27,8 +31,9 @@ fn main() { } for handle in handles { handle.join().unwrap(); - // TODO: Print the value of the JobStatus.jobs_completed. Did you notice anything - // interesting in the output? Do you have to 'join' on all the handles? + // TODO: Print the value of the JobStatus.jobs_completed. Did you notice + // anything interesting in the output? Do you have to 'join' on all the + // handles? println!("jobs completed {}", ???); } } diff --git a/exercises/threads/threads3.rs b/exercises/threads/threads3.rs index 9e9f285a..db7d41ba 100644 --- a/exercises/threads/threads3.rs +++ b/exercises/threads/threads3.rs @@ -1,5 +1,7 @@ // threads3.rs -// Execute `rustlings hint threads3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint threads3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/traits/traits1.rs b/exercises/traits/traits1.rs index f5320a5a..37dfcbfe 100644 --- a/exercises/traits/traits1.rs +++ b/exercises/traits/traits1.rs @@ -1,13 +1,11 @@ // traits1.rs -// Time to implement some traits! // -// Your task is to implement the trait -// `AppendBar` for the type `String`. +// Time to implement some traits! Your task is to implement the trait +// `AppendBar` for the type `String`. The trait AppendBar has only one function, +// which appends "Bar" to any object implementing this trait. // -// The trait AppendBar has only one function, -// which appends "Bar" to any object -// implementing this trait. -// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a hint. +// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/traits/traits2.rs b/exercises/traits/traits2.rs index 288b4983..3e35f8e1 100644 --- a/exercises/traits/traits2.rs +++ b/exercises/traits/traits2.rs @@ -1,14 +1,11 @@ // traits2.rs // -// Your task is to implement the trait -// `AppendBar` for a vector of strings. -// -// To implement this trait, consider for -// a moment what it means to 'append "Bar"' +// Your task is to implement the trait `AppendBar` for a vector of strings. To +// implement this trait, consider for a moment what it means to 'append "Bar"' // to a vector of strings. // -// No boiler plate code this time, -// you can do this! +// No boiler plate code this time, you can do this! +// // Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/traits/traits3.rs b/exercises/traits/traits3.rs index 6d2fd6c3..4e2b06b0 100644 --- a/exercises/traits/traits3.rs +++ b/exercises/traits/traits3.rs @@ -1,11 +1,12 @@ // traits3.rs // -// Your task is to implement the Licensed trait for -// both structures and have them return the same -// information without writing the same function twice. +// Your task is to implement the Licensed trait for both structures and have +// them return the same information without writing the same function twice. // // Consider what you can add to the Licensed trait. -// Execute `rustlings hint traits3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint traits3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/traits/traits4.rs b/exercises/traits/traits4.rs index 6b541665..4bda3e57 100644 --- a/exercises/traits/traits4.rs +++ b/exercises/traits/traits4.rs @@ -1,8 +1,11 @@ // traits4.rs // // Your task is to replace the '??' sections so the code compiles. +// // Don't change any line other than the marked one. -// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/traits/traits5.rs b/exercises/traits/traits5.rs index 0fbca28a..df183805 100644 --- a/exercises/traits/traits5.rs +++ b/exercises/traits/traits5.rs @@ -1,8 +1,11 @@ // traits5.rs // // Your task is to replace the '??' sections so the code compiles. +// // Don't change any line other than the marked one. -// Execute `rustlings hint traits5` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint traits5` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/variables/variables1.rs b/exercises/variables/variables1.rs index f4d182ac..b3e089a5 100644 --- a/exercises/variables/variables1.rs +++ b/exercises/variables/variables1.rs @@ -1,6 +1,9 @@ // variables1.rs +// // Make me compile! -// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/variables/variables2.rs b/exercises/variables/variables2.rs index 641aeb8e..e1c23edf 100644 --- a/exercises/variables/variables2.rs +++ b/exercises/variables/variables2.rs @@ -1,5 +1,7 @@ // variables2.rs -// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/variables/variables3.rs b/exercises/variables/variables3.rs index 819b1bc7..86bed419 100644 --- a/exercises/variables/variables3.rs +++ b/exercises/variables/variables3.rs @@ -1,5 +1,7 @@ // variables3.rs -// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/variables/variables4.rs b/exercises/variables/variables4.rs index 54491b0a..5394f394 100644 --- a/exercises/variables/variables4.rs +++ b/exercises/variables/variables4.rs @@ -1,5 +1,7 @@ // variables4.rs -// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/variables/variables5.rs b/exercises/variables/variables5.rs index 0e670d2a..a29b38be 100644 --- a/exercises/variables/variables5.rs +++ b/exercises/variables/variables5.rs @@ -1,5 +1,7 @@ // variables5.rs -// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/variables/variables6.rs b/exercises/variables/variables6.rs index a8520122..853183ba 100644 --- a/exercises/variables/variables6.rs +++ b/exercises/variables/variables6.rs @@ -1,5 +1,7 @@ // variables6.rs -// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a hint. +// +// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a +// hint. // I AM NOT DONE diff --git a/exercises/vecs/vecs1.rs b/exercises/vecs/vecs1.rs index 4e8c4cbb..65b7a7f8 100644 --- a/exercises/vecs/vecs1.rs +++ b/exercises/vecs/vecs1.rs @@ -1,7 +1,10 @@ // vecs1.rs -// Your task is to create a `Vec` which holds the exact same elements -// as in the array `a`. +// +// Your task is to create a `Vec` which holds the exact same elements as in the +// array `a`. +// // Make me compile and pass the test! +// // Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/vecs/vecs2.rs b/exercises/vecs/vecs2.rs index 1ea26071..e92c970a 100644 --- a/exercises/vecs/vecs2.rs +++ b/exercises/vecs/vecs2.rs @@ -1,6 +1,7 @@ // vecs2.rs -// A Vec of even numbers is given. Your task is to complete the loop -// so that each number in the Vec is multiplied by 2. +// +// A Vec of even numbers is given. Your task is to complete the loop so that +// each number in the Vec is multiplied by 2. // // Make me pass the test! // From 1e02f194fdd1cb1ca99cf1d93d11455db8b1bce6 Mon Sep 17 00:00:00 2001 From: tajo48 Date: Wed, 31 May 2023 16:37:41 +0200 Subject: [PATCH 10/52] update hint for vecs2 to match with exercise as it was updated to fix clarity --- info.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/info.toml b/info.toml index 2add5f0c..a7155d48 100644 --- a/info.toml +++ b/info.toml @@ -260,8 +260,8 @@ name = "vecs2" path = "exercises/vecs/vecs2.rs" mode = "test" hint = """ -Hint 1: `i` is each element from the Vec as they are being iterated. Can you try -multiplying this? +Hint 1: In the code, the variable `element` represents an item from the Vec as it is being iterated. +Can you try multiplying this? Hint 2: For the first function, there's a way to directly access the numbers stored in the Vec, using the * dereference operator. You can both access and write to the From a96bbcd9675933b19454d627ab6291d4739f0e53 Mon Sep 17 00:00:00 2001 From: luhem7 Date: Sat, 3 Jun 2023 10:20:29 -0400 Subject: [PATCH 11/52] fix(threads, smart pointers): Swap order of threads and smart pointers exercises closes #1541 --- info.toml | 122 +++++++++++++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/info.toml b/info.toml index 2add5f0c..3abb2f8c 100644 --- a/info.toml +++ b/info.toml @@ -905,67 +905,6 @@ The fold method can be useful in the count_collection_iterator function. For a further challenge, consult the documentation for Iterator to find a different method that could make your code more compact than using fold.""" -# THREADS - -[[exercises]] -name = "threads1" -path = "exercises/threads/threads1.rs" -mode = "compile" -hint = """ -`JoinHandle` is a struct that is returned from a spawned thread: -https://doc.rust-lang.org/std/thread/fn.spawn.html - -A challenge with multi-threaded applications is that the main thread can -finish before the spawned threads are completed. -https://doc.rust-lang.org/book/ch16-01-threads.html#waiting-for-all-threads-to-finish-using-join-handles - -Use the JoinHandles to wait for each thread to finish and collect their results. -https://doc.rust-lang.org/std/thread/struct.JoinHandle.html -""" - -[[exercises]] -name = "threads2" -path = "exercises/threads/threads2.rs" -mode = "compile" -hint = """ -`Arc` is an Atomic Reference Counted pointer that allows safe, shared access -to **immutable** data. But we want to *change* the number of `jobs_completed` -so we'll need to also use another type that will only allow one thread to -mutate the data at a time. Take a look at this section of the book: -https://doc.rust-lang.org/book/ch16-03-shared-state.html#atomic-reference-counting-with-arct -and keep reading if you'd like more hints :) - - -Do you now have an `Arc` `Mutex` `JobStatus` at the beginning of main? Like: -`let status = Arc::new(Mutex::new(JobStatus { jobs_completed: 0 }));` -Similar to the code in the example in the book that happens after the text -that says "We can use Arc to fix this.". If not, give that a try! If you -do and would like more hints, keep reading!! - - -Make sure neither of your threads are holding onto the lock of the mutex -while they are sleeping, since this will prevent the other thread from -being allowed to get the lock. Locks are automatically released when -they go out of scope. - -If you've learned from the sample solutions, I encourage you to come -back to this exercise and try it again in a few days to reinforce -what you've learned :)""" - -[[exercises]] -name = "threads3" -path = "exercises/threads/threads3.rs" -mode = "compile" -hint = """ -An alternate way to handle concurrency between threads is to use -a mpsc (multiple producer, single consumer) channel to communicate. -With both a sending end and a receiving end, it's possible to -send values in one thread and receive them in another. -Multiple producers are possible by using clone() to create a duplicate -of the original sending end. -See https://doc.rust-lang.org/book/ch16-02-message-passing.html for more info. -""" - # SMART POINTERS [[exercises]] @@ -1028,6 +967,67 @@ Check out https://doc.rust-lang.org/std/borrow/enum.Cow.html for documentation on the `Cow` type. """ +# THREADS + +[[exercises]] +name = "threads1" +path = "exercises/threads/threads1.rs" +mode = "compile" +hint = """ +`JoinHandle` is a struct that is returned from a spawned thread: +https://doc.rust-lang.org/std/thread/fn.spawn.html + +A challenge with multi-threaded applications is that the main thread can +finish before the spawned threads are completed. +https://doc.rust-lang.org/book/ch16-01-threads.html#waiting-for-all-threads-to-finish-using-join-handles + +Use the JoinHandles to wait for each thread to finish and collect their results. +https://doc.rust-lang.org/std/thread/struct.JoinHandle.html +""" + +[[exercises]] +name = "threads2" +path = "exercises/threads/threads2.rs" +mode = "compile" +hint = """ +`Arc` is an Atomic Reference Counted pointer that allows safe, shared access +to **immutable** data. But we want to *change* the number of `jobs_completed` +so we'll need to also use another type that will only allow one thread to +mutate the data at a time. Take a look at this section of the book: +https://doc.rust-lang.org/book/ch16-03-shared-state.html#atomic-reference-counting-with-arct +and keep reading if you'd like more hints :) + + +Do you now have an `Arc` `Mutex` `JobStatus` at the beginning of main? Like: +`let status = Arc::new(Mutex::new(JobStatus { jobs_completed: 0 }));` +Similar to the code in the example in the book that happens after the text +that says "We can use Arc to fix this.". If not, give that a try! If you +do and would like more hints, keep reading!! + + +Make sure neither of your threads are holding onto the lock of the mutex +while they are sleeping, since this will prevent the other thread from +being allowed to get the lock. Locks are automatically released when +they go out of scope. + +If you've learned from the sample solutions, I encourage you to come +back to this exercise and try it again in a few days to reinforce +what you've learned :)""" + +[[exercises]] +name = "threads3" +path = "exercises/threads/threads3.rs" +mode = "compile" +hint = """ +An alternate way to handle concurrency between threads is to use +a mpsc (multiple producer, single consumer) channel to communicate. +With both a sending end and a receiving end, it's possible to +send values in one thread and receive them in another. +Multiple producers are possible by using clone() to create a duplicate +of the original sending end. +See https://doc.rust-lang.org/book/ch16-02-message-passing.html for more info. +""" + # MACROS [[exercises]] From 479574e88eef4a4299b005388bec74f07a9c57d5 Mon Sep 17 00:00:00 2001 From: "Florine W. Dekker" Date: Wed, 7 Jun 2023 16:58:02 +0200 Subject: [PATCH 12/52] fix(vecs): rename outdated variable name in hint --- info.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/info.toml b/info.toml index 2add5f0c..8706ee51 100644 --- a/info.toml +++ b/info.toml @@ -260,8 +260,8 @@ name = "vecs2" path = "exercises/vecs/vecs2.rs" mode = "test" hint = """ -Hint 1: `i` is each element from the Vec as they are being iterated. Can you try -multiplying this? +Hint 1: `element` is each element from the Vec as they are being iterated. Can you +try multiplying this? Hint 2: For the first function, there's a way to directly access the numbers stored in the Vec, using the * dereference operator. You can both access and write to the From bbfb4c7e63dc59a4e8afbb8d2a10b35414782256 Mon Sep 17 00:00:00 2001 From: Bert Apperlo <91734527+b-apperlo@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:49:07 +0200 Subject: [PATCH 13/52] feat: added test function to hashmaps2.rs The existing test functions only check if a kind of fruit exists in the hashmap, but not if the amount of fruits is higher than zero. This new test function solves this. --- exercises/hashmaps/hashmaps2.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exercises/hashmaps/hashmaps2.rs b/exercises/hashmaps/hashmaps2.rs index a4f069a8..852c0760 100644 --- a/exercises/hashmaps/hashmaps2.rs +++ b/exercises/hashmaps/hashmaps2.rs @@ -80,4 +80,13 @@ mod tests { let count = basket.values().sum::(); assert!(count > 11); } + + #[test] + fn all_fruit_types_in_basket() { + let mut basket = get_fruit_basket(); + fruit_basket(&mut basket); + for amount in basket.values() { + assert_ne!(amount, &0); + } + } } From 8974e33f697abf55d322b7de051e8b41c219523d Mon Sep 17 00:00:00 2001 From: Bert Apperlo <91734527+b-apperlo@users.noreply.github.com> Date: Thu, 8 Jun 2023 16:44:39 +0200 Subject: [PATCH 14/52] fix: update hashmaps3.rs --- exercises/hashmaps/hashmaps3.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/exercises/hashmaps/hashmaps3.rs b/exercises/hashmaps/hashmaps3.rs index ad3baa68..982976c6 100644 --- a/exercises/hashmaps/hashmaps3.rs +++ b/exercises/hashmaps/hashmaps3.rs @@ -20,7 +20,6 @@ use std::collections::HashMap; // A structure to store team name and its goal details. struct Team { - name: String, goals_scored: u8, goals_conceded: u8, } From a4fe3602b238f38e9fd245874c863852791129fb Mon Sep 17 00:00:00 2001 From: Bert Apperlo <91734527+b-apperlo@users.noreply.github.com> Date: Thu, 8 Jun 2023 16:46:45 +0200 Subject: [PATCH 15/52] fix: updated comment for struct --- exercises/hashmaps/hashmaps3.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/hashmaps/hashmaps3.rs b/exercises/hashmaps/hashmaps3.rs index 982976c6..0d0a43ad 100644 --- a/exercises/hashmaps/hashmaps3.rs +++ b/exercises/hashmaps/hashmaps3.rs @@ -18,7 +18,7 @@ use std::collections::HashMap; -// A structure to store team name and its goal details. +// A structure to store the goal details of a team. struct Team { goals_scored: u8, goals_conceded: u8, From d0a17830831121fcdbc27a1833ccbbc17bc0c02d Mon Sep 17 00:00:00 2001 From: IVIURARY Date: Thu, 8 Jun 2023 22:14:25 +0100 Subject: [PATCH 16/52] fix(enums3): add test for message closes #1548 --- exercises/enums/enums3.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exercises/enums/enums3.rs b/exercises/enums/enums3.rs index a2a9d586..e75d4433 100644 --- a/exercises/enums/enums3.rs +++ b/exercises/enums/enums3.rs @@ -17,6 +17,7 @@ struct State { color: (u8, u8, u8), position: Point, quit: bool, + message: String } impl State { @@ -28,9 +29,7 @@ impl State { self.quit = true; } - fn echo(&self, s: String) { - println!("{}", s); - } + fn echo(&mut self, s: String) { self.message = s } fn move_position(&mut self, p: Point) { self.position = p; @@ -52,6 +51,7 @@ mod tests { quit: false, position: Point { x: 0, y: 0 }, color: (0, 0, 0), + message: "hello world".to_string(), }; state.process(Message::ChangeColor(255, 0, 255)); state.process(Message::Echo(String::from("hello world"))); @@ -62,5 +62,6 @@ mod tests { assert_eq!(state.position.x, 10); assert_eq!(state.position.y, 15); assert_eq!(state.quit, true); + assert_eq!(state.message, "hello world"); } } From f30f0bf148eab8b1a11fa7ee36f230e94aea417a Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 11 Jun 2023 16:30:01 -0500 Subject: [PATCH 17/52] chore(ci): add action step to check if lockfile is synced --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bf2a041a..1b244b1a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,6 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Fetch & maybe update Cargo.lock + run: cargo fetch --locked - name: Build run: cargo build --verbose - name: Run tests From 3cced07c1324a1d4e0b2f2e1e585cc1964d2bde3 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:50:02 +0000 Subject: [PATCH 18/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 50a477c0..8f8934e1 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -303,6 +303,7 @@ authors. b1ue64
b1ue64

πŸ–‹ lazywalker
lazywalker

πŸ–‹ + proofconstruction
proofconstruction

πŸš‡ From e0ea03dc567cd29c08012aa2da818c6f5599ab3b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:50:03 +0000 Subject: [PATCH 19/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 14ec3a98..15f9c56e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2136,6 +2136,15 @@ "contributions": [ "content" ] + }, + { + "login": "proofconstruction", + "name": "proofconstruction", + "avatar_url": "https://avatars.githubusercontent.com/u/74747193?v=4", + "profile": "https://github.com/proofconstruction", + "contributions": [ + "infra" + ] } ], "contributorsPerLine": 8, @@ -2144,5 +2153,6 @@ "repoType": "github", "repoHost": "https://github.com", "skipCi": true, - "commitConvention": "angular" + "commitConvention": "angular", + "commitType": "docs" } From 369ae2e63d06de6fee36aeebfd1ff3e8bcdfa25a Mon Sep 17 00:00:00 2001 From: liv Date: Mon, 12 Jun 2023 12:07:18 +0200 Subject: [PATCH 20/52] feat(move_semantics2): rewrite hint --- exercises/move_semantics/move_semantics2.rs | 10 +++---- info.toml | 29 +++++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/exercises/move_semantics/move_semantics2.rs b/exercises/move_semantics/move_semantics2.rs index 93bb82ef..66ddb4cd 100644 --- a/exercises/move_semantics/move_semantics2.rs +++ b/exercises/move_semantics/move_semantics2.rs @@ -2,23 +2,21 @@ // Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand for a hint. // Expected output: -// vec0 has length 3 content `[22, 44, 66]` -// vec1 has length 4 content `[22, 44, 66, 88]` +// vec0 has length 3, with contents `[22, 44, 66]` +// vec1 has length 4, with contents `[22, 44, 66, 88]` // I AM NOT DONE fn main() { let vec0 = Vec::new(); - // Do not move the following line! let mut vec1 = fill_vec(vec0); - // Do not change the following line! - println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0); + println!("{} has length {}, with contents: `{:?}`", "vec0", vec0.len(), vec0); vec1.push(88); - println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); + println!("{} has length {}, with contents `{:?}`", "vec1", vec1.len(), vec1); } fn fill_vec(vec: Vec) -> Vec { diff --git a/info.toml b/info.toml index 2add5f0c..8febf41d 100644 --- a/info.toml +++ b/info.toml @@ -287,23 +287,24 @@ Also: Try accessing `vec0` after having called `fill_vec()`. See what happens!"" [[exercises]] name = "move_semantics2" path = "exercises/move_semantics/move_semantics2.rs" -mode = "compile" +mode = "test" hint = """ -So, `vec0` is passed into the `fill_vec` function as an argument. In Rust, -when an argument is passed to a function and it's not explicitly returned, -you can't use the original variable anymore. We call this "moving" a variable. -Variables that are moved into a function (or block scope) and aren't explicitly -returned get "dropped" at the end of that function. This is also what happens here. -There's a few ways to fix this, try them all if you want: -1. Make another, separate version of the data that's in `vec0` and pass that +When running this exercise for the first time, you'll notice an error about +"borrow of moved value". In Rust, when an argument is passed to a function and +it's not explicitly returned, you can't use the original variable anymore. +We call this "moving" a variable. When we pass `vec0` into `fill_vec`, it's being +"moved" into `vec1`, meaning we can't access `vec0` anymore after the fact. +Rust provides a couple of different ways to mitigate this issue, feel free to try them all: +1. You could make another, separate version of the data that's in `vec0` and pass that to `fill_vec` instead. 2. Make `fill_vec` borrow its argument instead of taking ownership of it, - and then copy the data within the function in order to return an owned - `Vec` -3. Make `fill_vec` *mutably* borrow a reference to its argument (which will need to be - mutable), modify it directly, then not return anything. Then you can get rid - of `vec1` entirely -- note that this will change what gets printed by the - first `println!`""" + and then copy the data within the function (`vec.clone()`) in order to return an owned + `Vec`. +3. Or, you could make `fill_vec` *mutably* borrow a reference to its argument (which will need to be + mutable), modify it directly, then not return anything. This means that `vec0` will change over the + course of the function, and makes `vec1` redundant (make sure to change the parameters of the `println!` + statements if you go this route) +""" [[exercises]] name = "move_semantics3" From a1188ca0eea0e1a61217812bde3b085a7de998b5 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:17:21 +0000 Subject: [PATCH 21/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 8f8934e1..77f98ada 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -304,6 +304,7 @@ authors. b1ue64
b1ue64

πŸ–‹ lazywalker
lazywalker

πŸ–‹ proofconstruction
proofconstruction

πŸš‡ + IVIURRAY
IVIURRAY

πŸ–‹ From 47fcab1e603e7147e68bdf03b110f8799f2d5460 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:17:22 +0000 Subject: [PATCH 22/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 15f9c56e..6c0cb1fc 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2145,6 +2145,15 @@ "contributions": [ "infra" ] + }, + { + "login": "IVIURRAY", + "name": "IVIURRAY", + "avatar_url": "https://avatars.githubusercontent.com/u/16007179?v=4", + "profile": "https://www.youtube.com/channel/UCQCjA6qUutAtWqkCA4Z36CQ", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 4fd52390eec5e16b24cf26c1efaa961d4f0a365e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:18:54 +0000 Subject: [PATCH 23/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 77f98ada..4d151363 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -305,6 +305,7 @@ authors. lazywalker
lazywalker

πŸ–‹ proofconstruction
proofconstruction

πŸš‡ IVIURRAY
IVIURRAY

πŸ–‹ + Bert Apperlo
Bert Apperlo

πŸ–‹ From d35a352fe6f252217c65560e3c1addcd23e9a7f0 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:18:55 +0000 Subject: [PATCH 24/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 6c0cb1fc..760aa3a6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2154,6 +2154,15 @@ "contributions": [ "content" ] + }, + { + "login": "b-apperlo", + "name": "Bert Apperlo", + "avatar_url": "https://avatars.githubusercontent.com/u/91734527?v=4", + "profile": "https://github.com/b-apperlo", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From bd05bab4bfb14a7ef65424cdcd7af8f20d4a3dd1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:32:25 +0000 Subject: [PATCH 25/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 4d151363..a2219b2d 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -306,6 +306,7 @@ authors. proofconstruction
proofconstruction

πŸš‡ IVIURRAY
IVIURRAY

πŸ–‹ Bert Apperlo
Bert Apperlo

πŸ–‹ + Florine W. Dekker
Florine W. Dekker

πŸ–‹ From 5921948de8cd15e20e5812c0d1712ec4fc3e8127 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:32:26 +0000 Subject: [PATCH 26/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 760aa3a6..81e5f4f2 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2163,6 +2163,15 @@ "contributions": [ "content" ] + }, + { + "login": "FWDekker", + "name": "Florine W. Dekker", + "avatar_url": "https://avatars.githubusercontent.com/u/13442533?v=4", + "profile": "https://fwdekker.com/", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From a14f0c3f55ce326a6dfe5b7ed63cb0052985d1c4 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:33:44 +0000 Subject: [PATCH 27/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index a2219b2d..23dfa65f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -307,6 +307,7 @@ authors. IVIURRAY
IVIURRAY

πŸ–‹ Bert Apperlo
Bert Apperlo

πŸ–‹ Florine W. Dekker
Florine W. Dekker

πŸ–‹ + Mehul Gangavelli
Mehul Gangavelli

πŸ–‹ From 521962159592adc2031fc5ff513ce6385bb72a45 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:33:45 +0000 Subject: [PATCH 28/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 81e5f4f2..5e038774 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2172,6 +2172,15 @@ "contributions": [ "content" ] + }, + { + "login": "luhem7", + "name": "Mehul Gangavelli", + "avatar_url": "https://avatars.githubusercontent.com/u/4008215?v=4", + "profile": "https://github.com/luhem7", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From eb3c9658b166eb6aae1d05ea89d0863a554663b4 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:36:22 +0000 Subject: [PATCH 29/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 23dfa65f..723cc4a8 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -308,6 +308,7 @@ authors. Bert Apperlo
Bert Apperlo

πŸ–‹ Florine W. Dekker
Florine W. Dekker

πŸ–‹ Mehul Gangavelli
Mehul Gangavelli

πŸ–‹ + Mikael Frosthage
Mikael Frosthage

πŸ–‹ From a2f99ad00db939e63b8bdbbfbb9948a737fe0f5c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:36:23 +0000 Subject: [PATCH 30/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 5e038774..ab5d1424 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2181,6 +2181,15 @@ "contributions": [ "content" ] + }, + { + "login": "Frosthage", + "name": "Mikael Frosthage", + "avatar_url": "https://avatars.githubusercontent.com/u/14823314?v=4", + "profile": "https://github.com/Frosthage", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 33cf4f7eca5b309996cee25bced7dc76936f09b8 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:39:26 +0000 Subject: [PATCH 31/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index 723cc4a8..79306523 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -310,6 +310,9 @@ authors. Mehul Gangavelli
Mehul Gangavelli

πŸ–‹ Mikael Frosthage
Mikael Frosthage

πŸ–‹ + + Robert Fry
Robert Fry

πŸ–‹ + From 846e68e1aa601826e18f9e5e7b0fbf3fd0afd3e1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:39:27 +0000 Subject: [PATCH 32/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ab5d1424..393e59e2 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2190,6 +2190,15 @@ "contributions": [ "content" ] + }, + { + "login": "robertefry", + "name": "Robert Fry", + "avatar_url": "https://avatars.githubusercontent.com/u/43712054?v=4", + "profile": "https://robertfry.xyz", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From c236a80a37c46cc59d5fc6ba619a23229c9f816c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 08:42:01 +0000 Subject: [PATCH 33/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 79306523..ba208034 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -312,6 +312,7 @@ authors. Robert Fry
Robert Fry

πŸ–‹ + tajo48
tajo48

πŸ–‹ From 0cb63cdd01d133a1244ff18db448591fb3a40cd6 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 08:42:02 +0000 Subject: [PATCH 34/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 393e59e2..a8b82aeb 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2199,6 +2199,15 @@ "contributions": [ "content" ] + }, + { + "login": "tajo48", + "name": "tajo48", + "avatar_url": "https://avatars.githubusercontent.com/u/55502906?v=4", + "profile": "https://github.com/tajo48", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From c2264cabae976cf534be08942ff33f3a58f8795e Mon Sep 17 00:00:00 2001 From: liv Date: Thu, 15 Jun 2023 10:56:53 +0200 Subject: [PATCH 35/52] fix: install into $home on windows for now Stopgap measure so that people stop installing into System32 (since that's the default Powershell elevated prompt directory for some reason). --- install.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.ps1 b/install.ps1 index 97980c5b..7bab21f6 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,7 +1,7 @@ #!/usr/bin/env pwsh #Requires -Version 5 -param($path = "$pwd/rustlings") +param($path = "$home/rustlings") Write-Host "Let's get you set up with Rustlings!" @@ -91,4 +91,4 @@ if (!$clippy) { rustup component add clippy } -Write-Host "All done! Run 'rustlings' to get started." +Write-Host "All done! Navigate to $path and run 'rustlings' to get started!" From adc7ca56901ed1f53659fb8fa139a65423affd13 Mon Sep 17 00:00:00 2001 From: liv Date: Thu, 22 Jun 2023 10:10:44 +0200 Subject: [PATCH 36/52] fix(move_semantics2): change type back to compile --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index ba3e585a..b4fd8ffa 100644 --- a/info.toml +++ b/info.toml @@ -287,7 +287,7 @@ Also: Try accessing `vec0` after having called `fill_vec()`. See what happens!"" [[exercises]] name = "move_semantics2" path = "exercises/move_semantics/move_semantics2.rs" -mode = "test" +mode = "compile" hint = """ When running this exercise for the first time, you'll notice an error about "borrow of moved value". In Rust, when an argument is passed to a function and From eacf7db6f34f7c884b2a736a35fa997299b34485 Mon Sep 17 00:00:00 2001 From: Anish <98446102+novanish@users.noreply.github.com> Date: Fri, 23 Jun 2023 17:18:17 +0545 Subject: [PATCH 37/52] refactor: Update comment to use correct construct name 'Result' instead of 'Option' Refactor the comment in the code to provide a more accurate description of the construct being used. Replace the mention of Option with Result. --- exercises/error_handling/errors1.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/error_handling/errors1.rs b/exercises/error_handling/errors1.rs index 0ba59a57..13d2724c 100644 --- a/exercises/error_handling/errors1.rs +++ b/exercises/error_handling/errors1.rs @@ -3,7 +3,7 @@ // This function refuses to generate text to be printed on a nametag if you pass // it an empty string. It'd be nicer if it explained what the problem was, // instead of just sometimes returning `None`. Thankfully, Rust has a similar -// construct to `Option` that can be used to express error conditions. Let's use +// construct to `Result` that can be used to express error conditions. Let's use // it! // // Execute `rustlings hint errors1` or use the `hint` watch subcommand for a From f03a915c750a47cfbabb13413e200d82f0e45405 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 07:58:23 +0000 Subject: [PATCH 38/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index ba208034..c7ef5209 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -313,6 +313,7 @@ authors. Robert Fry
Robert Fry

πŸ–‹ tajo48
tajo48

πŸ–‹ + Anish
Anish

πŸ–‹ From 2e4022dd730869c9065f8b9f1aa031cbb0b2f0fa Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 07:58:24 +0000 Subject: [PATCH 39/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index a8b82aeb..0c985add 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2208,6 +2208,15 @@ "contributions": [ "content" ] + }, + { + "login": "novanish", + "name": "Anish", + "avatar_url": "https://avatars.githubusercontent.com/u/98446102?v=4", + "profile": "https://anishchhetri.com.np", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 405b32e77a6643f08e5bc895d6d2d1e684d47324 Mon Sep 17 00:00:00 2001 From: vnprc <9425366+vnprc@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:17:39 -0400 Subject: [PATCH 40/52] chore: use correct line number in strings2.rs hint --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index b4fd8ffa..e4863cbf 100644 --- a/info.toml +++ b/info.toml @@ -439,7 +439,7 @@ mode = "compile" hint = """ Yes, it would be really easy to fix this by just changing the value bound to `word` to be a string slice instead of a `String`, wouldn't it?? There is a way to add one character to line -9, though, that will coerce the `String` into a string slice. +12, though, that will coerce the `String` into a string slice. Side note: If you're interested in learning about how this kind of reference conversion works, you can jump ahead in the book and read this part in the smart pointers chapter: https://doc.rust-lang.org/stable/book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods""" From 47b3a531325932a0051b0dba91c3a8fd86aa2fe1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:19:52 +0000 Subject: [PATCH 41/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index c7ef5209..4e777174 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -314,6 +314,7 @@ authors. Robert Fry
Robert Fry

πŸ–‹ tajo48
tajo48

πŸ–‹ Anish
Anish

πŸ–‹ + vnprc
vnprc

πŸ–‹ From a46d42f45e7052fbadb457cd303ff62f5a641555 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:19:53 +0000 Subject: [PATCH 42/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0c985add..d02fe784 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2217,6 +2217,15 @@ "contributions": [ "content" ] + }, + { + "login": "vnprc", + "name": "vnprc", + "avatar_url": "https://avatars.githubusercontent.com/u/9425366?v=4", + "profile": "https://github.com/vnprc", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From c5b0627180ae98c41f67e345b2a16ca14a6cffd1 Mon Sep 17 00:00:00 2001 From: liv Date: Mon, 3 Jul 2023 18:50:50 +0200 Subject: [PATCH 43/52] chore: update oranda config for 0.1.0 --- oranda.json | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/oranda.json b/oranda.json index 18ef8c68..603e474e 100644 --- a/oranda.json +++ b/oranda.json @@ -1,10 +1,25 @@ { - "homepage": "https://rustlings.cool", - "repository": "https://github.com/rust-lang/rustlings", - "analytics": { - "plausible": { - "domain": "rustlings.cool" + "project": { + "homepage": "https://rustlings.cool", + "repository": "https://github.com/rust-lang/rustlings" + }, + "marketing": { + "analytics": { + "plausible": { + "domain": "rustlings.cool" + } } }, - "changelog": false + "components": { + "artifacts": { + "cargo_dist": false, + "package_managers": { + "preferred": { + "macos/linux/unix": "curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash", + "windows": "Start-BitsTransfer -Source https://raw.githubusercontent.com/rust-lang/rustlings/main/install.ps1 -Destination $env:TMP/install_rustlings.ps1; Unblock-File $env:TMP/install_rustlings.ps1; Invoke-Expression $env:TMP/install_rustlings.ps1" + } + } + }, + "changelog": true + } } From 287172698aea106723682542e011b64f3d6d218a Mon Sep 17 00:00:00 2001 From: Joshua Carlson Date: Mon, 3 Jul 2023 14:52:13 -0400 Subject: [PATCH 44/52] added if3 based on: `Using if in a let Statement` --- exercises/if/if3.rs | 55 +++++++++++++++++++++++++++++++++++++++++++++ info.toml | 7 ++++++ 2 files changed, 62 insertions(+) create mode 100644 exercises/if/if3.rs diff --git a/exercises/if/if3.rs b/exercises/if/if3.rs new file mode 100644 index 00000000..73a7025b --- /dev/null +++ b/exercises/if/if3.rs @@ -0,0 +1,55 @@ +// if3.rs +// +// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint. + +// I AM NOT DONE + +pub fn animal_habitat(animal: &str) -> &'static str { + let identifier = if animal == "crab" { + 1 + } else if animal == "gopher" { + 2.0 + } else if animal == "snake" { + 3 + } else { + "Unknown" + }; + + // DO NOT CHANGE THIS STATEMENT BELOW + let habitat = if identifier == 1 { + "Beach" + } else if identifier == 2 { + "Burrow" + } else if identifier == 3 { + "Desert" + } else { + "Unknown" + }; + + habitat +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn gopher_lives_in_burrow() { + assert_eq!(animal_habitat("gopher"), "Burrow") + } + + #[test] + fn snake_lives_in_desert() { + assert_eq!(animal_habitat("snake"), "Desert") + } + + #[test] + fn crab_lives_on_beach() { + assert_eq!(animal_habitat("crab"), "Beach") + } + + #[test] + fn unknown_animal() { + assert_eq!(animal_habitat("dinosaur"), "Unknown") + } +} diff --git a/info.toml b/info.toml index e4863cbf..e8a28cbc 100644 --- a/info.toml +++ b/info.toml @@ -167,6 +167,13 @@ For that first compiler error, it's important in Rust that each conditional block returns the same type! To get the tests passing, you will need a couple conditions checking different input values.""" +[[exercises]] +name = "if3" +path = "exercises/if/if3.rs" +mode = "test" +hint = """ +In Rust, every arm of an `if` expression has to return the same type of value. Make sure the type is consistent across all arms.""" + # QUIZ 1 [[exercises]] From 0e0c5dfe99b99b7723ea9ec77733214c69b2a8ae Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 09:57:30 +0000 Subject: [PATCH 45/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 4e777174..6c1ee1e3 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -315,6 +315,7 @@ authors. tajo48
tajo48

πŸ–‹ Anish
Anish

πŸ–‹ vnprc
vnprc

πŸ–‹ + Joshua Carlson
Joshua Carlson

πŸ–‹ From 176fb7c447e9310c5c5ccc511ee8f61ad14adc9b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 09:57:31 +0000 Subject: [PATCH 46/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index d02fe784..37b86693 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2226,6 +2226,15 @@ "contributions": [ "content" ] + }, + { + "login": "jrcarl624", + "name": "Joshua Carlson", + "avatar_url": "https://avatars.githubusercontent.com/u/61999256?v=4", + "profile": "http://androecia.net", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 2934d062a30be177056fcded950bd5339b636b8f Mon Sep 17 00:00:00 2001 From: "Nicholas R. Smith" Date: Fri, 14 Jul 2023 10:47:42 -0700 Subject: [PATCH 47/52] fix: run cargo update to build proc-macro2 on nightly --- Cargo.lock | 192 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 126 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a09d98f7..a8268d90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -77,15 +77,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "console" -version = "0.15.5" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -114,14 +114,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -176,11 +176,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "home" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "winapi 0.3.9", + "windows-sys 0.48.0", ] [[package]] @@ -226,9 +226,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" [[package]] name = "kernel32-sys" @@ -254,18 +254,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" @@ -318,9 +315,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.38" +version = "0.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" dependencies = [ "cfg-if 0.1.10", "libc", @@ -397,18 +394,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.53" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73" +checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -424,9 +421,21 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.2" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce168fea28d3e05f158bda4576cf0c844d5045bc2cc3620fa0292ed5bb5814c" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", @@ -435,9 +444,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.29" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "rustlings" @@ -459,9 +468,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" [[package]] name = "same-file" @@ -474,29 +483,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.158" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.158" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.8", + "syn 2.0.25", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" dependencies = [ "itoa", "ryu", @@ -525,9 +534,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.8" +version = "2.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc02725fd69ab9f26eab07fad303e2497fad6fb9eba4f96c4d1687bdf704ad9" +checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" dependencies = [ "proc-macro2", "quote", @@ -551,9 +560,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "unicode-width" @@ -614,28 +623,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - [[package]] name = "windows-sys" version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.1", ] [[package]] @@ -644,13 +647,28 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -659,42 +677,84 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "ws2_32-sys" version = "0.2.1" From f4d86f384c396ed0741e93f71c314c5ed503f12c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 10:31:15 +0000 Subject: [PATCH 48/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 6c1ee1e3..04ef1fc6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -316,6 +316,7 @@ authors. Anish
Anish

πŸ–‹ vnprc
vnprc

πŸ–‹ Joshua Carlson
Joshua Carlson

πŸ–‹ + Nicholas R. Smith
Nicholas R. Smith

πŸ’» From 2c7dec73275a12f8e47e0f60c2f1686e579bdc7a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 10:31:16 +0000 Subject: [PATCH 49/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 37b86693..ac074d39 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2235,6 +2235,15 @@ "contributions": [ "content" ] + }, + { + "login": "johnDeSilencio", + "name": "Nicholas R. Smith", + "avatar_url": "https://avatars.githubusercontent.com/u/20136554?v=4", + "profile": "https://johndesilencio.me", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 8, From ef8f1f108ba2ed109eea93684ea29861085cea31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Gonz=C3=A1lez?= Date: Fri, 21 Jul 2023 14:42:19 +0200 Subject: [PATCH 50/52] docs: dedup repeated sentence --- exercises/quiz1.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index a9904b8b..4ee5ada7 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -9,7 +9,7 @@ // - An apple costs 2 rustbucks. // - If Mary buys more than 40 apples, each apple only costs 1 rustbuck! // Write a function that calculates the price of an order of apples given the -// quantity bought. No hints this time! +// quantity bought. // // No hints this time ;) From 8283ae8c4c90acde71a98037107b018ec8fc454b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:29:17 +0000 Subject: [PATCH 51/52] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 04ef1fc6..3dde8407 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -317,6 +317,7 @@ authors. vnprc
vnprc

πŸ–‹ Joshua Carlson
Joshua Carlson

πŸ–‹ Nicholas R. Smith
Nicholas R. Smith

πŸ’» + Alexander GonzΓ‘lez
Alexander GonzΓ‘lez

πŸ–‹ From bb5fa3f1e8b867f03d5db4d6ab53a1fdfdfad062 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:29:18 +0000 Subject: [PATCH 52/52] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ac074d39..8a3034da 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2244,6 +2244,15 @@ "contributions": [ "code" ] + }, + { + "login": "alexfertel", + "name": "Alexander GonzΓ‘lez", + "avatar_url": "https://avatars.githubusercontent.com/u/22298999?v=4", + "profile": "https://alexfertel.me", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8,