From cc3e1a851118b13ce3b2774d6437665b5aca0dc4 Mon Sep 17 00:00:00 2001 From: mokou Date: Sat, 16 Jul 2022 14:17:24 +0200 Subject: [PATCH 01/53] doc: update changelog --- CHANGELOG.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 095877b..8aae313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,76 @@ + +## 5.0.0 (2022-07-16) + +#### Features + +- Hint comments in exercises now also include a reference to the + `hint` watch mode subcommand. +- **intro1**: Added more hints to point the user to the source file. +- **variables**: Switched variables3 and variables4. +- Moved `vec` and `primitive_types` exercises before `move_semantics`. +- Renamed `vec` to `vecs` to be more in line with the naming in general. +- Split up the `collections` exercises in their own folders. +- **vec2**: Added a second part of the function that provides an alternative, + immutable way of modifying vec values. +- **enums3**: Added a hint. +- Moved `strings` before `modules`. +- Added a `strings3` exercise to teach modifying strings. +- Added a `hashmaps3` exercise for some advanced usage of hashmaps. +- Moved the original `quiz2` to be `strings4`, since it only tested strings + anyways. +- Reworked `quiz2` into a new exercise that tests more chapters. +- Renamed `option` to `options`. +- **options1**: Rewrote parts of the exercise to remove the weird array + iteration stuff. +- Moved `generics3` to be `quiz3`. +- Moved box/arc exercises behind `iterators`. +- **iterators4**: Added a test for factorials of zero. +- Split `threads1` between two exercises, the first one focusing more on + `JoinHandle`s. +- Added a `threads3` exercises that uses `std::sync::mpsc`. +- Added a `clippy3` exercises with some more interesting checks. +- **as_ref_mut**: Added a section that actually tests `AsMut`. +- Added 3 new lifetimes exercises. +- Added 3 new traits exercises. + +#### Bug Fixes + +- **variables2**: Made output messages more verbose. +- **variables5**: Added a nudging hint about shadowing. +- **variables6**: Fixed link to book. +- **functions**: Clarified the README wording. Generally cleaned up + some hints and added some extra comments. +- **if2**: Renamed function name to `foo_if_fizz`. +- **move_semantics**: Clarified some hints. +- **quiz1**: Renamed the function name to be more verbose. +- **structs1**: Use an integer type instead of strings. Renamed "unit structs" + to "unit-like structs", as is used in the book. +- **structs3**: Added the `panic!` statement in from the beginning. +- **errors1**: Use `is_empty()` instead of `len() > 0` +- **errors3**: Improved the hint. +- **errors5**: Improved exercise instructions and the hint. +- **errors6**: Provided the skeleton of one of the functions that's supposed + to be implemented. +- **iterators3**: Inserted `todo!` into `divide()` to keep a compiler error + from happening. +- **from_str**: Added a hint comment about string error message conversion with + `Box`. +- **try_from_into**: Fixed the function name in comment. + +#### Removed + +- Removed the legacy LSP feature that was using `mod.rs` files. +- Removed `quiz4`. +- Removed `advanced_errs`. These were the last exercises in the recommended + order, and I've always felt like they didn't quite fit in with the mostly + simple, book-following style we've had in Rustlings. + +#### Housekeeping + +- Added missing exercises to the book index. +- Updated spacing in Cargo.toml. +- Added a GitHub actions config so that tests run on every PR/commit. + ## 4.8.0 (2022-07-01) From 5138f22e00137768054147b022f3f269190d3eb8 Mon Sep 17 00:00:00 2001 From: mokou Date: Sat, 16 Jul 2022 14:25:10 +0200 Subject: [PATCH 02/53] doc: update book links --- exercises/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/exercises/README.md b/exercises/README.md index 2ea2990..e52137c 100644 --- a/exercises/README.md +++ b/exercises/README.md @@ -5,20 +5,22 @@ | variables | §3.1 | | functions | §3.3 | | if | §3.5 | -| move_semantics | §4.1, §4.2 | | primitive_types | §3.2, §4.3 | +| vecs | §8.1 | +| move_semantics | §4.1, §4.2 | | structs | §5.1, §5.3 | | enums | §6, §18.3 | -| modules | §7 | -| collections | §8.1, §8.3 | | strings | §8.2 | +| modules | §7 | +| hashmaps | §8.3 | +| options | §10.1 | | error_handling | §9 | | generics | §10 | -| option | §10.1 | | traits | §10.2 | | tests | §11.1 | +| lifetimes | §10.3 | | standard_library_types | §13.2, §15.1, §16.3 | -| threads | §16.1 | +| threads | §16.1, §16.2, §16.3 | | macros | §19.6 | | clippy | n/a | | conversions | n/a | From 5435b8084177941c8cf86e17a8fccaf1cef359a4 Mon Sep 17 00:00:00 2001 From: mokou Date: Sat, 16 Jul 2022 14:30:04 +0200 Subject: [PATCH 03/53] chore: bump version --- Cargo.toml | 2 +- README.md | 4 ++-- src/main.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a3264d..910b538 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustlings" -version = "4.8.0" +version = "5.0.0" authors = ["Liv ", "Carol (Nichols || Goulding) "] edition = "2021" diff --git a/README.md b/README.md index 103aec8..f238732 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ If you get a permission denied message, you might have to exclude the directory Basically: Clone the repository at the latest tag, run `cargo install`. ```bash -# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 4.7.1) -git clone -b 4.7.1 --depth 1 https://github.com/rust-lang/rustlings +# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.0.0) +git clone -b 5.0.0 --depth 1 https://github.com/rust-lang/rustlings cd rustlings cargo install --force --path . ``` diff --git a/src/main.rs b/src/main.rs index 15c3095..0ddb733 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,7 +26,7 @@ mod run; mod verify; // In sync with crate version -const VERSION: &str = "4.8.0"; +const VERSION: &str = "5.0.0"; #[derive(FromArgs, PartialEq, Debug)] /// Rustlings is a collection of small exercises to get you used to writing and reading Rust code From 55900c65cbcd88a8458ea5ba29e06c1897f344d5 Mon Sep 17 00:00:00 2001 From: wojexe <21208490+wojexe@users.noreply.github.com> Date: Sat, 16 Jul 2022 17:28:13 +0200 Subject: [PATCH 04/53] fix: make strings3.rs comment wording more clear fixes #1063 --- exercises/strings/strings3.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/strings/strings3.rs b/exercises/strings/strings3.rs index 9e25d30..e2353ae 100644 --- a/exercises/strings/strings3.rs +++ b/exercises/strings/strings3.rs @@ -4,7 +4,7 @@ // I AM NOT DONE fn trim_me(input: &str) -> String { - // TODO: Remove whitespace from the end of a string! + // TODO: Remove whitespace from both ends of a string! ??? } From e8cf9b262882adc77dd15e958ae038882ee10719 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 16 Jul 2022 16:27:40 +0000 Subject: [PATCH 05/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 1a0c167..ba75fe6 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -195,6 +195,7 @@ authors.
James Bromley

🖋
swhiteCQC

🖋
Neil Pate

🖋 +
wojexe

🖋 From 3bb008ebbb52a4ab24131918bb8809f1eeba8480 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 16 Jul 2022 16:27:41 +0000 Subject: [PATCH 06/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index bd4e390..cc6939f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1371,6 +1371,15 @@ "contributions": [ "content" ] + }, + { + "login": "wojexe", + "name": "wojexe", + "avatar_url": "https://avatars.githubusercontent.com/u/21208490?v=4", + "profile": "https://wojexe.com", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From b0e070c743d1f9a4a4eeb5c33a1e9ded8ab9bc12 Mon Sep 17 00:00:00 2001 From: wojexe <21208490+wojexe@users.noreply.github.com> Date: Sat, 16 Jul 2022 19:51:50 +0200 Subject: [PATCH 07/53] fix(traits4.rs): wrong line number fixes #1067 --- exercises/traits/traits4.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/traits/traits4.rs b/exercises/traits/traits4.rs index 280aaad..6b54166 100644 --- a/exercises/traits/traits4.rs +++ b/exercises/traits/traits4.rs @@ -1,7 +1,7 @@ // traits4.rs // // Your task is to replace the '??' sections so the code compiles. -// Don't change any line other than 21. +// Don't change any line other than the marked one. // Execute `rustlings hint traits4` or use the `hint` watch subcommand for a hint. // I AM NOT DONE @@ -19,6 +19,7 @@ struct OtherSoftware {} impl Licensed for SomeSoftware {} impl Licensed for OtherSoftware {} +// YOU MAY ONLY CHANGE THE NEXT LINE fn compare_license_types(software: ??, software_two: ??) -> bool { software.licensing_info() == software_two.licensing_info() } From 7035d6787cd551ece7d582d052685c52875a6a72 Mon Sep 17 00:00:00 2001 From: Tostapunk Date: Mon, 18 Jul 2022 00:27:57 +0200 Subject: [PATCH 08/53] fix(traits5.rs): wrong line number --- exercises/traits/traits5.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/traits/traits5.rs b/exercises/traits/traits5.rs index 290c047..89174dd 100644 --- a/exercises/traits/traits5.rs +++ b/exercises/traits/traits5.rs @@ -1,7 +1,7 @@ // traits5.rs // // Your task is to replace the '??' sections so the code compiles. -// Don't change any line other than 27. +// Don't change any line other than the marked one. // Execute `rustlings hint traits5` or use the `hint` watch subcommand for a hint. // I AM NOT DONE @@ -25,6 +25,7 @@ struct SomeStruct { impl SomeTrait for SomeStruct {} impl OtherTrait for SomeStruct {} +// YOU MAY ONLY CHANGE THE NEXT LINE fn some_func(item: ??) -> bool { item.some_function() && item.other_function() } From 2f113b9b06b986d17c4da86ae5a5bd8a4405f83d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 18 Jul 2022 08:47:49 +0000 Subject: [PATCH 09/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index ba75fe6..f015c8f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -196,6 +196,7 @@ authors.
swhiteCQC

🖋
Neil Pate

🖋
wojexe

🖋 +
Mattia Schiavon

🖋 From 1aecf32748fbccec18b044e91a533165bc52e226 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 18 Jul 2022 08:47:49 +0000 Subject: [PATCH 10/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index cc6939f..9659044 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1380,6 +1380,15 @@ "contributions": [ "content" ] + }, + { + "login": "Tostapunk", + "name": "Mattia Schiavon", + "avatar_url": "https://avatars.githubusercontent.com/u/25140297?v=4", + "profile": "https://github.com/Tostapunk", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 02d78c3e84c8f160b6f6487be0a368b5720bb67b Mon Sep 17 00:00:00 2001 From: Tostapunk Date: Mon, 18 Jul 2022 14:11:51 +0200 Subject: [PATCH 11/53] fix: Improve hint of lifetimes2 fixes #1071 --- info.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/info.toml b/info.toml index 5b7b9b4..3ec15d7 100644 --- a/info.toml +++ b/info.toml @@ -795,7 +795,10 @@ name = "lifetimes2" path = "exercises/lifetimes/lifetimes2.rs" mode = "compile" hint = """ -What is the compiler checking? How could you change how long an owned variable lives?""" +Remember that the generic lifetime 'a will get the concrete lifetime that is equal to the smaller of the lifetimes of x and y. +You can take at leats two paths to achieve the desidered result while keeping the inner block: +1. move string2 declaration to make it live as long as string1 (how is result declared?) +2. move println! into the inner block""" [[exercises]] name = "lifetimes3" From e1d6abb4c919386fd5c728a30db73d160c6fe373 Mon Sep 17 00:00:00 2001 From: Mattia Schiavon Date: Mon, 18 Jul 2022 14:44:16 +0200 Subject: [PATCH 12/53] Apply suggestions from code review Co-authored-by: liv --- info.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.toml b/info.toml index 3ec15d7..0be3e91 100644 --- a/info.toml +++ b/info.toml @@ -796,9 +796,9 @@ path = "exercises/lifetimes/lifetimes2.rs" mode = "compile" hint = """ Remember that the generic lifetime 'a will get the concrete lifetime that is equal to the smaller of the lifetimes of x and y. -You can take at leats two paths to achieve the desidered result while keeping the inner block: -1. move string2 declaration to make it live as long as string1 (how is result declared?) -2. move println! into the inner block""" +You can take at least two paths to achieve the desired result while keeping the inner block: +1. Move the string2 declaration to make it live as long as string1 (how is result declared?) +2. Move println! into the inner block""" [[exercises]] name = "lifetimes3" From 8a4dca5fa63913d42eddd443485f5a7c9d9f5319 Mon Sep 17 00:00:00 2001 From: Eric Jolibois Date: Tue, 19 Jul 2022 11:45:34 +0200 Subject: [PATCH 13/53] remove small typo in hint of threads3 --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index 0be3e91..f90d10a 100644 --- a/info.toml +++ b/info.toml @@ -988,7 +988,7 @@ 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 receieve them in another. -Multiple producers are possibile by using clone() to create a duplicate +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. """ From 3b74f5dae88f6097d2eb07694ec2bd0823db9c0a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 19 Jul 2022 12:40:22 +0000 Subject: [PATCH 14/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index f015c8f..ca763de 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -197,6 +197,7 @@ authors.
Neil Pate

🖋
wojexe

🖋
Mattia Schiavon

🖋 +
Eric Jolibois

🖋 From 82c41a61b6c6389244814a56ee272687bc8e262b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 19 Jul 2022 12:40:23 +0000 Subject: [PATCH 15/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 9659044..3903233 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1389,6 +1389,15 @@ "contributions": [ "content" ] + }, + { + "login": "PrettyWood", + "name": "Eric Jolibois", + "avatar_url": "https://avatars.githubusercontent.com/u/18406791?v=4", + "profile": "http://toucantoco.com", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From f9413b8ae1c9fe8bd9ebed01f27450e8b98f233e Mon Sep 17 00:00:00 2001 From: Greg Leonard Date: Tue, 19 Jul 2022 20:05:04 +0100 Subject: [PATCH 16/53] fix(traits5): fix "paramter" spelling --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index f90d10a..1403111 100644 --- a/info.toml +++ b/info.toml @@ -732,7 +732,7 @@ name = "traits5" path = "exercises/traits/traits5.rs" mode = "compile" hint = """ -To ensure a paramter implements multiple traits use the '+ syntax'. Try replacing the +To ensure a parameter implements multiple traits use the '+ syntax'. Try replacing the '??' with 'impl <> + <>'. See the documentation at: https://doc.rust-lang.org/book/ch10-02-traits.html#specifying-multiple-trait-bounds-with-the--syntax From f34d390bba3d60df0766df432bca9bc5eb171478 Mon Sep 17 00:00:00 2001 From: Edwin Chang Date: Wed, 20 Jul 2022 18:23:31 -0400 Subject: [PATCH 17/53] fix: Fix typo in .editorconfig --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 89cf181..aab09aa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,6 +2,6 @@ root = true [*.rs] end_of_line = lf -insert_final_newfile = true +insert_final_newline = true indent_style = space indent_size = 4 From e9f5c9423c8004fdccbe3dc300479497ed27c067 Mon Sep 17 00:00:00 2001 From: Greg Leonard Date: Thu, 21 Jul 2022 23:13:22 +0100 Subject: [PATCH 18/53] fix(run): correct "PAS" in `integration_tests.rs` --- tests/integration_tests.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index fc46b98..0be191f 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -176,7 +176,7 @@ fn run_single_test_success_with_output() { .current_dir("tests/fixture/success/") .assert() .code(0) - .stdout(predicates::str::contains("THIS TEST TOO SHALL PAS")); + .stdout(predicates::str::contains("THIS TEST TOO SHALL PASS")); } #[test] @@ -187,7 +187,7 @@ fn run_single_test_success_without_output() { .current_dir("tests/fixture/success/") .assert() .code(0) - .stdout(predicates::str::contains("THIS TEST TOO SHALL PAS").not()); + .stdout(predicates::str::contains("THIS TEST TOO SHALL PASS").not()); } #[test] From 2356b5c1b6a68cbcafb7643ba900adba4483d38a Mon Sep 17 00:00:00 2001 From: Saikat Das Date: Sat, 23 Jul 2022 15:55:30 +0530 Subject: [PATCH 19/53] Fix manual installation with install to the current directory --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f238732..afa55c8 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ If you get a permission denied message, you might have to exclude the directory ## Manually -Basically: Clone the repository at the latest tag, run `cargo install`. +Basically: Clone the repository at the latest tag, run `cargo install --path .`. ```bash # find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.0.0) From 56c05f6232a1cd4cfa5444b1d391f88feef98e7b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 23 Jul 2022 15:37:05 +0000 Subject: [PATCH 20/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index ca763de..27103bf 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -199,6 +199,9 @@ authors.
Mattia Schiavon

🖋
Eric Jolibois

🖋 + +
Edwin Chang

🖋 + From e858fd94fbed689b4533605ea133c8030a93197a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 23 Jul 2022 15:37:06 +0000 Subject: [PATCH 21/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 3903233..cd43669 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1398,6 +1398,15 @@ "contributions": [ "content" ] + }, + { + "login": "EdwinChang24", + "name": "Edwin Chang", + "avatar_url": "https://avatars.githubusercontent.com/u/88263098?v=4", + "profile": "http://edwinchang.vercel.app", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From c1fc77e50ffdca83f5f5cb03d28aef3c60bd76f2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 23 Jul 2022 15:41:02 +0000 Subject: [PATCH 22/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 27103bf..212bd60 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -201,6 +201,7 @@ authors.
Edwin Chang

🖋 +
Saikat Das

🖋 From 7a6079b46adb5e9c81e5c83ebce614b359a57239 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 23 Jul 2022 15:41:03 +0000 Subject: [PATCH 23/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index cd43669..6450a9c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1407,6 +1407,15 @@ "contributions": [ "content" ] + }, + { + "login": "saikatdas0790", + "name": "Saikat Das", + "avatar_url": "https://avatars.githubusercontent.com/u/7412443?v=4", + "profile": "https://saikat.dev/", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From f88c7d1e8c89d26f5180082d68d4b79e4ec47b48 Mon Sep 17 00:00:00 2001 From: Jeremy Goh <30731072+thatlittleboy@users.noreply.github.com> Date: Sun, 24 Jul 2022 00:36:27 +0800 Subject: [PATCH 24/53] fix: reference to variables4 --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index 1403111..7bb753e 100644 --- a/info.toml +++ b/info.toml @@ -63,7 +63,7 @@ name = "variables5" path = "exercises/variables/variables5.rs" mode = "compile" hint = """ -In variables3 we already learned how to make an immutable variable mutable +In variables4 we already learned how to make an immutable variable mutable using a special keyword. Unfortunately this doesn't help us much in this exercise because we want to assign a different typed value to an existing variable. Sometimes you may also like to reuse existing variable names because you are just converting From 301bc52857554e047eabf32fec323f7a10e2b853 Mon Sep 17 00:00:00 2001 From: Jeremy Goh <30731072+thatlittleboy@users.noreply.github.com> Date: Sun, 24 Jul 2022 00:37:40 +0800 Subject: [PATCH 25/53] fix: lineno typo --- info.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/info.toml b/info.toml index 7bb753e..f07b926 100644 --- a/info.toml +++ b/info.toml @@ -123,8 +123,8 @@ name = "functions4" path = "exercises/functions/functions4.rs" mode = "compile" hint = """ -The error message points to line 14 and says it expects a type after the -`->`. This is where the function's return type should be-- take a look at +The error message points to line 17 and says it expects a type after the +`->`. This is where the function's return type should be -- take a look at the `is_even` function for an example! Also: Did you figure out that, technically, u32 would be the more fitting type From 72e21a2a6c2654cb1d2e292291e2e40914957776 Mon Sep 17 00:00:00 2001 From: Denton24646 Date: Sat, 23 Jul 2022 17:57:03 -0400 Subject: [PATCH 26/53] feat: add cow1.rs exercise --- exercises/standard_library_types/cow1.rs | 48 ++++++++++++++++++++++++ info.toml | 11 ++++++ 2 files changed, 59 insertions(+) create mode 100644 exercises/standard_library_types/cow1.rs diff --git a/exercises/standard_library_types/cow1.rs b/exercises/standard_library_types/cow1.rs new file mode 100644 index 0000000..5fba251 --- /dev/null +++ b/exercises/standard_library_types/cow1.rs @@ -0,0 +1,48 @@ +// 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. + +// I AM NOT DONE + +use std::borrow::Cow; + +fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> { + for i in 0..input.len() { + let v = input[i]; + if v < 0 { + // Clones into a vector if not already owned. + input.to_mut()[i] = -v; + } + } + input +} + +fn main() { + // No clone occurs because `input` doesn't need to be mutated. + let slice = [0, 1, 2]; + let mut input = Cow::from(&slice[..]); + match abs_all(&mut input) { + Cow::Borrowed(_) => println!("I borrowed the slice!"), + _ => panic!("expected borrowed value"), + } + + // Clone occurs because `input` needs to be mutated. + let slice = [-1, 0, 1]; + let mut input = Cow::from(&slice[..]); + match abs_all(&mut input) { + Cow::Owned(_) => println!("I modified the slice and now own it!"), + _ => panic!("expected owned value"), + } + + // No clone occurs because `input` is already owned. + let slice = vec![-1, 0, 1]; + let mut input = Cow::from(slice); + match abs_all(&mut input) { + // TODO + Cow::Borrowed(_) => println!("I own this slice!"), + _ => panic!("expected borrowed value"), + } +} diff --git a/info.toml b/info.toml index 1403111..230fc72 100644 --- a/info.toml +++ b/info.toml @@ -932,6 +932,17 @@ is too much of a struggle, consider reading through all of Chapter 16 in the boo https://doc.rust-lang.org/stable/book/ch16-00-concurrency.html """ +[[exercises]] +name = "cow1" +path = "exercises/standard_library_types/cow1.rs" +mode = "compile" +hint = """ +Since the vector is already owned, the `Cow` type doesn't need to clone it. + +Checkout https://doc.rust-lang.org/std/borrow/enum.Cow.html for documentation +on the `Cow` type. +""" + # THREADS [[exercises]] From 32687cc66e04cc8b4975672847c7def48d9bb08a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 24 Jul 2022 21:26:12 +0000 Subject: [PATCH 27/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 212bd60..ca64185 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -202,6 +202,7 @@ authors.
Edwin Chang

🖋
Saikat Das

🖋 +
Jeremy Goh

🖋 From 4bee3399f8be446c414cdad3c2c2a9983a3f3e35 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sun, 24 Jul 2022 21:26:13 +0000 Subject: [PATCH 28/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 6450a9c..ae6156a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1416,6 +1416,15 @@ "contributions": [ "content" ] + }, + { + "login": "thatlittleboy", + "name": "Jeremy Goh", + "avatar_url": "https://avatars.githubusercontent.com/u/30731072?v=4", + "profile": "https://github.com/thatlittleboy", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From a3a5fbeddf7ad891514a7cf4d51a582efdedb0f1 Mon Sep 17 00:00:00 2001 From: Claire Wang Date: Mon, 25 Jul 2022 17:54:09 -0700 Subject: [PATCH 29/53] fix: remove extra " typo in info.toml --- info.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.toml b/info.toml index f07b926..dc1485d 100644 --- a/info.toml +++ b/info.toml @@ -746,7 +746,7 @@ path = "exercises/quiz3.rs" mode = "test" hint = """ To find the best solution to this challenge you're going to need to think back to your -knowledge of traits, specifically Trait Bound Syntax - you may also need this: "use std::fmt::Display;"""" +knowledge of traits, specifically Trait Bound Syntax - you may also need this: `use std::fmt::Display;`.""" # TESTS From a56f648ccefc18292c2fbc2e61043348c7cde79d Mon Sep 17 00:00:00 2001 From: Tristan Nicholls Date: Tue, 26 Jul 2022 21:01:09 +0200 Subject: [PATCH 30/53] feat(options1): update expected result Expected result is updated to better showcase the difference between - a valid result with no ice-creams `Some(0)`, and - an invalid result `None`. --- exercises/options/options1.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exercises/options/options1.rs b/exercises/options/options1.rs index 038fb48..c93ffba 100644 --- a/exercises/options/options1.rs +++ b/exercises/options/options1.rs @@ -14,6 +14,7 @@ fn print_number(maybe_number: Option) { // 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 + // The Option output should gracefully handle cases where time_of_day > 24. ??? } @@ -24,8 +25,9 @@ mod tests { #[test] fn check_icecream() { assert_eq!(maybe_icecream(10), Some(5)); - assert_eq!(maybe_icecream(23), None); - assert_eq!(maybe_icecream(22), None); + assert_eq!(maybe_icecream(23), Some(0)); + assert_eq!(maybe_icecream(22), Some(0)); + assert_eq!(maybe_icecream(25), None); } #[test] From c5ecc37a9afd8eaad3b184d97a0e532eef163b41 Mon Sep 17 00:00:00 2001 From: Lioness100 Date: Sat, 30 Jul 2022 10:50:07 -0400 Subject: [PATCH 31/53] refactor(box1): prefer todo! over unimplemented! --- exercises/standard_library_types/box1.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/standard_library_types/box1.rs b/exercises/standard_library_types/box1.rs index 9d9237c..66cf00f 100644 --- a/exercises/standard_library_types/box1.rs +++ b/exercises/standard_library_types/box1.rs @@ -10,7 +10,7 @@ // 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 `unimplemented!()` +// Step 2: create both empty and non-empty cons lists by replacing `todo!()` // // Note: the tests should not be changed // @@ -33,11 +33,11 @@ fn main() { } pub fn create_empty_list() -> List { - unimplemented!() + todo!() } pub fn create_non_empty_list() -> List { - unimplemented!() + todo!() } #[cfg(test)] From a04d62372fcf6023fceb0f2e8202de61ca774585 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:13:18 +0000 Subject: [PATCH 32/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index ca64185..e6f7a35 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -203,6 +203,7 @@ authors.
Edwin Chang

🖋
Saikat Das

🖋
Jeremy Goh

🖋 +
Lioness100

🖋 From 08f42761f9b04dd63ac30ae3a503577ded560f3f Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:13:19 +0000 Subject: [PATCH 33/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index ae6156a..7d6ec03 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1425,6 +1425,15 @@ "contributions": [ "content" ] + }, + { + "login": "Lioness100", + "name": "Lioness100", + "avatar_url": "https://avatars.githubusercontent.com/u/65814829?v=4", + "profile": "https://github.com/Lioness100", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From af301a2efe7309b3a59df4f236322eb246140402 Mon Sep 17 00:00:00 2001 From: mokou Date: Wed, 3 Aug 2022 17:31:42 +0200 Subject: [PATCH 34/53] feat(errors5): add simpler explanation for box dyn --- Cargo.lock | 2 +- exercises/error_handling/errors5.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index df190ad..862a8a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,7 +459,7 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "rustlings" -version = "4.8.0" +version = "5.0.0" dependencies = [ "argh", "assert_cmd", diff --git a/exercises/error_handling/errors5.rs b/exercises/error_handling/errors5.rs index 67411c5..2ba8f90 100644 --- a/exercises/error_handling/errors5.rs +++ b/exercises/error_handling/errors5.rs @@ -4,6 +4,8 @@ // 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 From e3b65186fde9690180a0efe9283f466a2e13076d Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:34:59 +0000 Subject: [PATCH 35/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index e6f7a35..263bc2f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -204,6 +204,7 @@ authors.
Saikat Das

🖋
Jeremy Goh

🖋
Lioness100

🖋 +
Tristan Nicholls

🖋 From 6289238d1d35d13fe44d7385ebe0016519db7adc Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:35:00 +0000 Subject: [PATCH 36/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7d6ec03..5ff2c66 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1434,6 +1434,15 @@ "contributions": [ "content" ] + }, + { + "login": "tvkn", + "name": "Tristan Nicholls", + "avatar_url": "https://avatars.githubusercontent.com/u/79277926?v=4", + "profile": "https://github.com/tvkn", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From d27c12e35d7a1290ad1daccfe69e309da765e810 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:36:07 +0000 Subject: [PATCH 37/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 263bc2f..e0689db 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -205,6 +205,7 @@ authors.
Jeremy Goh

🖋
Lioness100

🖋
Tristan Nicholls

🖋 +
Claire

🖋 From 7a7281764c03beb3560e7dba8759bcb7eab71f99 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:36:08 +0000 Subject: [PATCH 38/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 5ff2c66..5fc58e7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1443,6 +1443,15 @@ "contributions": [ "content" ] + }, + { + "login": "clairew", + "name": "Claire", + "avatar_url": "https://avatars.githubusercontent.com/u/9344258?v=4", + "profile": "http://clairewang.net", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From a0a06232ce30ff7ec52367033865cad9cac6ae76 Mon Sep 17 00:00:00 2001 From: John Mendelewski III Date: Sun, 7 Aug 2022 14:51:16 -0400 Subject: [PATCH 39/53] fix(traits5): make exercise prefer trait-based solution closes #1088 --- exercises/traits/traits5.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exercises/traits/traits5.rs b/exercises/traits/traits5.rs index 89174dd..0fbca28 100644 --- a/exercises/traits/traits5.rs +++ b/exercises/traits/traits5.rs @@ -18,16 +18,20 @@ pub trait OtherTrait { } } -struct SomeStruct { - name: String, -} +struct SomeStruct {} +struct OtherStruct {} impl SomeTrait for SomeStruct {} impl OtherTrait for SomeStruct {} +impl SomeTrait for OtherStruct {} +impl OtherTrait for OtherStruct {} // YOU MAY ONLY CHANGE THE NEXT LINE fn some_func(item: ??) -> bool { item.some_function() && item.other_function() } -fn main() {} +fn main() { + some_func(SomeStruct {}); + some_func(OtherStruct {}); +} From f25f77e915035dc913f680593bc4892e5f8edeaf Mon Sep 17 00:00:00 2001 From: Brian Fakhoury Date: Mon, 8 Aug 2022 15:39:35 -0400 Subject: [PATCH 40/53] Fix minor spelling --- exercises/quiz2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/quiz2.rs b/exercises/quiz2.rs index f7437fd..d8fa954 100644 --- a/exercises/quiz2.rs +++ b/exercises/quiz2.rs @@ -42,7 +42,7 @@ mod my_module { #[cfg(test)] mod tests { - // TODO: What to we have to import to have `transformer` in scope? + // TODO: What do we have to import to have `transformer` in scope? use ???; use super::Command; From ef70ad907f4615b34abe3e65c7b21fffe7661f35 Mon Sep 17 00:00:00 2001 From: Mouwrice Date: Tue, 9 Aug 2022 20:27:27 +0200 Subject: [PATCH 41/53] fix(macros-readme): update the book link to the more recent version of the book --- exercises/macros/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/macros/README.md b/exercises/macros/README.md index 319d840..31a941b 100644 --- a/exercises/macros/README.md +++ b/exercises/macros/README.md @@ -7,4 +7,4 @@ macros. Instead, we'll show you how to use and create them. ## Further information - [Macros](https://doc.rust-lang.org/book/ch19-06-macros.html) -- [The Little Book of Rust Macros](https://danielkeep.github.io/tlborm/book/index.html) +- [The Little Book of Rust Macros](https://veykril.github.io/tlborm/) From bf84fe029f05e05c65efaaaa36f04cf6ed19235b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 11 Aug 2022 10:27:27 +0000 Subject: [PATCH 42/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index e0689db..66f4b9e 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -206,6 +206,7 @@ authors.
Lioness100

🖋
Tristan Nicholls

🖋
Claire

🖋 +
Maurice Van Wassenhove

🖋 From 8d9df94b6c6682d607976001f16cba851f5979a9 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 11 Aug 2022 10:27:28 +0000 Subject: [PATCH 43/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 5fc58e7..d97c45f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1452,6 +1452,15 @@ "contributions": [ "content" ] + }, + { + "login": "Mouwrice", + "name": "Maurice Van Wassenhove", + "avatar_url": "https://avatars.githubusercontent.com/u/56763273?v=4", + "profile": "https://github.com/Mouwrice", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From dcf4efe62851823c31ea78b929b4450de86fecfe Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 11 Aug 2022 10:30:24 +0000 Subject: [PATCH 44/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 66f4b9e..6dcbbee 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -207,6 +207,7 @@ authors.
Tristan Nicholls

🖋
Claire

🖋
Maurice Van Wassenhove

🖋 +
John Mendelewski

💻 From c1c4f863172bf36ce6822e05d210bc2d82fdcbce Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 11 Aug 2022 10:30:25 +0000 Subject: [PATCH 45/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index d97c45f..4133fc2 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1461,6 +1461,15 @@ "contributions": [ "content" ] + }, + { + "login": "johnmendel", + "name": "John Mendelewski", + "avatar_url": "https://avatars.githubusercontent.com/u/77524?v=4", + "profile": "http://jmthree.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 8, From 7e1a4c03637f38ff8f380652c26fcfee637fe47c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 11 Aug 2022 10:38:00 +0000 Subject: [PATCH 46/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index 6dcbbee..613a2c0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -209,6 +209,9 @@ authors.
Maurice Van Wassenhove

🖋
John Mendelewski

💻 + +
Brian Fakhoury

🖋 + From a16e7b918a1ce3e257f39db6182289cad047748c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 11 Aug 2022 10:38:01 +0000 Subject: [PATCH 47/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 4133fc2..87af2a5 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1470,6 +1470,15 @@ "contributions": [ "code" ] + }, + { + "login": "brianfakhoury", + "name": "Brian Fakhoury", + "avatar_url": "https://avatars.githubusercontent.com/u/20828724?v=4", + "profile": "http://fakhoury.xyz", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From 3c84cc1702200eea4d3e57feff34e69705dc8ed1 Mon Sep 17 00:00:00 2001 From: Markus Boehme Date: Thu, 11 Aug 2022 22:52:06 +0200 Subject: [PATCH 48/53] fix(options1): remove unused code Since rewriting the exercise in commit 06e4fd376586 the print_number function goes unused. Remove it. --- exercises/options/options1.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/exercises/options/options1.rs b/exercises/options/options1.rs index c93ffba..99c9591 100644 --- a/exercises/options/options1.rs +++ b/exercises/options/options1.rs @@ -3,11 +3,6 @@ // I AM NOT DONE -// you can modify anything EXCEPT for this function's signature -fn print_number(maybe_number: Option) { - println!("printing: {}", maybe_number.unwrap()); -} - // 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 :( From cf813b707cf9ef0593ae58853eb693594c5fc03c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 08:25:12 +0000 Subject: [PATCH 49/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 613a2c0..9648f33 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -211,6 +211,7 @@ authors.
Brian Fakhoury

🖋 +
Markus Boehme

💻 From f107e2f31d961b949868967cd2f66dc78136411c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 08:25:13 +0000 Subject: [PATCH 50/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 87af2a5..0df89f7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1479,6 +1479,15 @@ "contributions": [ "content" ] + }, + { + "login": "markusboehme", + "name": "Markus Boehme", + "avatar_url": "https://avatars.githubusercontent.com/u/5074759?v=4", + "profile": "https://github.com/markusboehme", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 8, From e8122daa8709274226c40fe8008fdfc86ad4493a Mon Sep 17 00:00:00 2001 From: Nico Vromans <48183857+nico-vromans@users.noreply.github.com> Date: Mon, 15 Aug 2022 10:05:50 +0200 Subject: [PATCH 51/53] Update options1.rs Added extra test for before 10PM and updated the test for at 10PM (when it's 10PM there should already not be any ice cream left, as per the description). Also fixed the `raw_value` test, as it is later than 10PM, so there should be no more ice cream left. --- exercises/options/options1.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/options/options1.rs b/exercises/options/options1.rs index 99c9591..022d3d6 100644 --- a/exercises/options/options1.rs +++ b/exercises/options/options1.rs @@ -19,7 +19,8 @@ mod tests { #[test] fn check_icecream() { - assert_eq!(maybe_icecream(10), Some(5)); + assert_eq!(maybe_icecream(9), Some(5)); + assert_eq!(maybe_icecream(10), Some(0)); assert_eq!(maybe_icecream(23), Some(0)); assert_eq!(maybe_icecream(22), Some(0)); assert_eq!(maybe_icecream(25), None); @@ -29,6 +30,6 @@ mod tests { fn raw_value() { // TODO: Fix this test. How do you get at the value contained in the Option? let icecreams = maybe_icecream(12); - assert_eq!(icecreams, 5); + assert_eq!(icecreams, 0); } } From 4400ce2892188044d510cbabdfead1f0c704bdf8 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Aug 2022 07:32:31 +0000 Subject: [PATCH 52/53] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 9648f33..0c07a93 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -212,6 +212,7 @@ authors.
Brian Fakhoury

🖋
Markus Boehme

💻 +
Nico Vromans

🖋 From 2f2f141564f3bfc34c9a0a0d5449ea376f7835f8 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 16 Aug 2022 07:32:32 +0000 Subject: [PATCH 53/53] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0df89f7..be5dc21 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1488,6 +1488,15 @@ "contributions": [ "code" ] + }, + { + "login": "nico-vromans", + "name": "Nico Vromans", + "avatar_url": "https://avatars.githubusercontent.com/u/48183857?v=4", + "profile": "https://github.com/nico-vromans", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8,