From adc7ca56901ed1f53659fb8fa139a65423affd13 Mon Sep 17 00:00:00 2001 From: liv Date: Thu, 22 Jun 2023 10:10:44 +0200 Subject: [PATCH 01/11] 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 ba3e585..b4fd8ff 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 02/11] 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 0ba59a5..13d2724 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 03/11] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index ba20803..c7ef520 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 04/11] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index a8b82ae..0c985ad 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 05/11] 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 b4fd8ff..e4863cb 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 06/11] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index c7ef520..4e77717 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 07/11] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0c985ad..d02fe78 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 08/11] 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 18ef8c6..603e474 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 09/11] 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 0000000..73a7025 --- /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 e4863cb..e8a28cb 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 10/11] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 4e77717..6c1ee1e 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 11/11] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index d02fe78..37b8669 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,