From a4a5691a7b3fac8201cf2965d94267da12bae47f Mon Sep 17 00:00:00 2001 From: Sebastian LaVine Date: Sun, 16 Apr 2023 21:44:08 -0400 Subject: [PATCH 1/9] feat: Add "!" command to `rustlings watch` --- src/main.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 704398e..793b826 100644 --- a/src/main.rs +++ b/src/main.rs @@ -298,13 +298,21 @@ fn spawn_watch_shell( println!("Bye!"); } else if input.eq("help") { println!("Commands available to you in watch mode:"); - println!(" hint - prints the current exercise's hint"); - println!(" clear - clears the screen"); - println!(" quit - quits watch mode"); - println!(" help - displays this help message"); + println!(" hint - prints the current exercise's hint"); + println!(" clear - clears the screen"); + println!(" quit - quits watch mode"); + println!(" ! - executes a command, like `!rustc --explain E0381`"); + println!(" help - displays this help message"); println!(); println!("Watch mode automatically re-evaluates the current exercise"); println!("when you edit a file's contents.") + } else if let Some(cmd) = input.strip_prefix('!') { + let parts: Vec<&str> = cmd.split_whitespace().collect(); + if parts.is_empty() { + println!("no command provided"); + } else if let Err(e) = Command::new(parts[0]).args(&parts[1..]).status() { + println!("failed to execute command `{}`: {}", cmd, e); + } } else { println!("unknown command: {input}"); } From 4944488287ca28bb73b067c3b0321adb6fb010ae Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:51:24 +0000 Subject: [PATCH 2/9] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 9e757bc..f5accd7 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -288,6 +288,7 @@ authors. Aaron Suggs
Aaron Suggs

🖋 Alex
Alex

🖋 Sebastian Törnquist
Sebastian Törnquist

🖋 + Sebastian LaVine
Sebastian LaVine

💻 From 6209e7004e24492776edc5408260707949e6ffee Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:51:25 +0000 Subject: [PATCH 3/9] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index bdcf53c..9c39e5e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2037,6 +2037,15 @@ "contributions": [ "content" ] + }, + { + "login": "smlavine", + "name": "Sebastian LaVine", + "avatar_url": "https://avatars.githubusercontent.com/u/33563640?v=4", + "profile": "http://smlavine.com", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 8, From 319a8253ba727d09a1c52c7d22b4e089137ecff9 Mon Sep 17 00:00:00 2001 From: Alan Gerber Date: Thu, 20 Apr 2023 12:15:31 -0400 Subject: [PATCH 4/9] fix(move_semantics2): fix line number comment Commit fef8314 added three lines of comments, which left the line numbers expected to stay unchanged mentioned on line 2 out of date. --- exercises/move_semantics/move_semantics2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/move_semantics/move_semantics2.rs b/exercises/move_semantics/move_semantics2.rs index 68dbf02..ae76a7a 100644 --- a/exercises/move_semantics/move_semantics2.rs +++ b/exercises/move_semantics/move_semantics2.rs @@ -1,5 +1,5 @@ // move_semantics2.rs -// Make me compile without changing line 13 or moving line 10! +// Make me compile without changing line 17 or moving line 14! // Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand for a hint. // Expected output: From 065cd0170e46fbdf0f74aee4708c4e3a200ab6ce Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 22 Apr 2023 13:48:41 +0000 Subject: [PATCH 5/9] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index f5accd7..0f45c38 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -290,6 +290,9 @@ authors. Sebastian Törnquist
Sebastian Törnquist

🖋 Sebastian LaVine
Sebastian LaVine

💻 + + Alan Gerber
Alan Gerber

🖋 + From 545a7262523cfe3074e91314ad621d84e48d81c1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 22 Apr 2023 13:48:42 +0000 Subject: [PATCH 6/9] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 9c39e5e..8dd0d92 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2046,6 +2046,15 @@ "contributions": [ "code" ] + }, + { + "login": "akgerber", + "name": "Alan Gerber", + "avatar_url": "https://avatars.githubusercontent.com/u/201313?v=4", + "profile": "http://www.alangerber.us", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8, From c4627e7112f38a74e677f358bf5eafc7214c5a4f Mon Sep 17 00:00:00 2001 From: PiqqiDesigns Date: Thu, 27 Apr 2023 15:49:40 -0700 Subject: [PATCH 7/9] chore: clarified cow owned_no_mutation comments --- exercises/smart_pointers/cow1.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/smart_pointers/cow1.rs b/exercises/smart_pointers/cow1.rs index 885138a..bc5b28e 100644 --- a/exercises/smart_pointers/cow1.rs +++ b/exercises/smart_pointers/cow1.rs @@ -52,7 +52,8 @@ mod tests { 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 always was. + // 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) { From 72d0c53b33e45cc55a5eb0c82119b7e393c0c59b Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 28 Apr 2023 08:40:17 +0000 Subject: [PATCH 8/9] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 0f45c38..8e4d0fa 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -292,6 +292,7 @@ authors. Alan Gerber
Alan Gerber

🖋 + Eric
Eric

🖋 From eb4079c674640b4fc307d5dca7a23dcef33129f2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 28 Apr 2023 08:40:18 +0000 Subject: [PATCH 9/9] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 8dd0d92..a973b2d 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2055,6 +2055,15 @@ "contributions": [ "content" ] + }, + { + "login": "esotuvaka", + "name": "Eric", + "avatar_url": "https://avatars.githubusercontent.com/u/104941850?v=4", + "profile": "http://esotuvaka.github.io", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8,