From be0b7e084ed5713d74c7f1bacdfd563fb2145a95 Mon Sep 17 00:00:00 2001 From: TK Buristrakul Date: Thu, 24 Nov 2022 19:20:59 +0000 Subject: [PATCH 1/3] chore: minor change in comment --- exercises/quiz2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/quiz2.rs b/exercises/quiz2.rs index 606d3c7..715788b 100644 --- a/exercises/quiz2.rs +++ b/exercises/quiz2.rs @@ -42,7 +42,7 @@ mod my_module { #[cfg(test)] mod tests { - // TODO: What do we have to import to have `transformer` in scope? + // TODO: What do we need to import to have `transformer` in scope? use ???; use super::Command; From a315f2fefb963c2facfd80efe336b8be3b8f6bfa Mon Sep 17 00:00:00 2001 From: TK Buristrakul Date: Thu, 24 Nov 2022 19:39:54 +0000 Subject: [PATCH 2/3] chore: added more descriptive TODOs --- exercises/conversions/as_ref_mut.rs | 13 +++++++------ exercises/options/options1.rs | 2 +- exercises/traits/traits1.rs | 2 +- exercises/traits/traits2.rs | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/exercises/conversions/as_ref_mut.rs b/exercises/conversions/as_ref_mut.rs index c9eed7d..e6a9d11 100644 --- a/exercises/conversions/as_ref_mut.rs +++ b/exercises/conversions/as_ref_mut.rs @@ -5,21 +5,22 @@ // I AM NOT DONE -// Obtain the number of bytes (not characters) in the given argument -// Add the AsRef trait appropriately as a trait bound +// Obtain the number of bytes (not characters) in the given argument. +// TODO: Add the AsRef trait appropriately as a trait bound. fn byte_counter(arg: T) -> usize { arg.as_ref().as_bytes().len() } -// Obtain the number of characters (not bytes) in the given argument -// Add the AsRef trait appropriately as a trait bound +// Obtain the number of characters (not bytes) in the given argument. +// TODO: Add the AsRef trait appropriately as a trait bound. fn char_counter(arg: T) -> usize { arg.as_ref().chars().count() } -// Squares a number using as_mut(). Add the trait bound as is appropriate and -// implement the function body. +// Squares a number using as_mut(). +// TODO: Add the appropriate trait bound. fn num_sq(arg: &mut T) { + // TODO: Implement the function body. ??? } diff --git a/exercises/options/options1.rs b/exercises/options/options1.rs index 1149af0..1f891b0 100644 --- a/exercises/options/options1.rs +++ b/exercises/options/options1.rs @@ -6,10 +6,10 @@ // This function returns how much icecream there is left in the fridge. // If it's before 10PM, there's 5 pieces left. At 10PM, someone eats them // all, so there'll be no more left :( -// TODO: Return an Option! 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. + // TODO: Complete the function body - remember to return an Option! ??? } diff --git a/exercises/traits/traits1.rs b/exercises/traits/traits1.rs index 5b9d8d5..43500b8 100644 --- a/exercises/traits/traits1.rs +++ b/exercises/traits/traits1.rs @@ -16,7 +16,7 @@ trait AppendBar { } impl AppendBar for String { - //Add your code here + // TODO: Implement `AppendBar` for type `String`. } fn main() { diff --git a/exercises/traits/traits2.rs b/exercises/traits/traits2.rs index 708bb19..99dc1cb 100644 --- a/exercises/traits/traits2.rs +++ b/exercises/traits/traits2.rs @@ -17,7 +17,7 @@ trait AppendBar { fn append_bar(self) -> Self; } -//TODO: Add your code here +// TODO: Implement trait `AppendBar` for a vector of strings. #[cfg(test)] mod tests { From db53dbc12615888ddd021025379fbab8e00e5067 Mon Sep 17 00:00:00 2001 From: TK Buristrakul Date: Thu, 24 Nov 2022 19:41:25 +0000 Subject: [PATCH 3/3] chore: tidied up unmatched backticks --- exercises/traits/traits1.rs | 2 +- exercises/traits/traits2.rs | 2 +- info.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/traits/traits1.rs b/exercises/traits/traits1.rs index 43500b8..f5320a5 100644 --- a/exercises/traits/traits1.rs +++ b/exercises/traits/traits1.rs @@ -2,7 +2,7 @@ // Time to implement some traits! // // Your task is to implement the trait -// `AppendBar' for the type `String'. +// `AppendBar` for the type `String`. // // The trait AppendBar has only one function, // which appends "Bar" to any object diff --git a/exercises/traits/traits2.rs b/exercises/traits/traits2.rs index 99dc1cb..288b498 100644 --- a/exercises/traits/traits2.rs +++ b/exercises/traits/traits2.rs @@ -1,7 +1,7 @@ // traits2.rs // // Your task is to implement the trait -// `AppendBar' for a vector of strings. +// `AppendBar` for a vector of strings. // // To implement this trait, consider for // a moment what it means to 'append "Bar"' diff --git a/info.toml b/info.toml index df3820d..4b87819 100644 --- a/info.toml +++ b/info.toml @@ -695,7 +695,7 @@ name = "traits2" path = "exercises/traits/traits2.rs" mode = "test" hint = """ -Notice how the trait takes ownership of 'self',and returns `Self'. +Notice how the trait takes ownership of 'self',and returns `Self`. Try mutating the incoming string vector. Have a look at the tests to see what the result should look like!