diff --git a/.all-contributorsrc b/.all-contributorsrc index bdcf53c6..a973b2d7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2037,6 +2037,33 @@ "contributions": [ "content" ] + }, + { + "login": "smlavine", + "name": "Sebastian LaVine", + "avatar_url": "https://avatars.githubusercontent.com/u/33563640?v=4", + "profile": "http://smlavine.com", + "contributions": [ + "code" + ] + }, + { + "login": "akgerber", + "name": "Alan Gerber", + "avatar_url": "https://avatars.githubusercontent.com/u/201313?v=4", + "profile": "http://www.alangerber.us", + "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, diff --git a/AUTHORS.md b/AUTHORS.md index 9e757bc2..8e4d0fab 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -288,6 +288,11 @@ authors. Aaron Suggs
Aaron Suggs

🖋 Alex
Alex

🖋 Sebastian Törnquist
Sebastian Törnquist

🖋 + Sebastian LaVine
Sebastian LaVine

💻 + + + Alan Gerber
Alan Gerber

🖋 + Eric
Eric

🖋 diff --git a/exercises/smart_pointers/cow1.rs b/exercises/smart_pointers/cow1.rs index 885138a7..bc5b28e5 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) { diff --git a/src/main.rs b/src/main.rs index 704398e5..793b826d 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}"); }