Skip to content

Commit d3fea5f

Browse files
authored
Merge branch 'main' into patch-2
2 parents 8ed2cf7 + b75d2aa commit d3fea5f

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

.all-contributorsrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,33 @@
20372037
"contributions": [
20382038
"content"
20392039
]
2040+
},
2041+
{
2042+
"login": "smlavine",
2043+
"name": "Sebastian LaVine",
2044+
"avatar_url": "https://avatars.githubusercontent.com/u/33563640?v=4",
2045+
"profile": "http://smlavine.com",
2046+
"contributions": [
2047+
"code"
2048+
]
2049+
},
2050+
{
2051+
"login": "akgerber",
2052+
"name": "Alan Gerber",
2053+
"avatar_url": "https://avatars.githubusercontent.com/u/201313?v=4",
2054+
"profile": "http://www.alangerber.us",
2055+
"contributions": [
2056+
"content"
2057+
]
2058+
},
2059+
{
2060+
"login": "esotuvaka",
2061+
"name": "Eric",
2062+
"avatar_url": "https://avatars.githubusercontent.com/u/104941850?v=4",
2063+
"profile": "http://esotuvaka.github.io",
2064+
"contributions": [
2065+
"content"
2066+
]
20402067
}
20412068
],
20422069
"contributorsPerLine": 8,

AUTHORS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@ authors.
288288
<td align="center" valign="top" width="12.5%"><a href="https://ktheory.com/"><img src="https://avatars.githubusercontent.com/u/975?v=4?s=100" width="100px;" alt="Aaron Suggs"/><br /><sub><b>Aaron Suggs</b></sub></a><br /><a href="#content-ktheory" title="Content">🖋</a></td>
289289
<td align="center" valign="top" width="12.5%"><a href="https://github.com/alexwh"><img src="https://avatars.githubusercontent.com/u/1723612?v=4?s=100" width="100px;" alt="Alex"/><br /><sub><b>Alex</b></sub></a><br /><a href="#content-alexwh" title="Content">🖋</a></td>
290290
<td align="center" valign="top" width="12.5%"><a href="https://github.com/stornquist"><img src="https://avatars.githubusercontent.com/u/42915664?v=4?s=100" width="100px;" alt="Sebastian Törnquist"/><br /><sub><b>Sebastian Törnquist</b></sub></a><br /><a href="#content-stornquist" title="Content">🖋</a></td>
291+
<td align="center" valign="top" width="12.5%"><a href="http://smlavine.com"><img src="https://avatars.githubusercontent.com/u/33563640?v=4?s=100" width="100px;" alt="Sebastian LaVine"/><br /><sub><b>Sebastian LaVine</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=smlavine" title="Code">💻</a></td>
292+
</tr>
293+
<tr>
294+
<td align="center" valign="top" width="12.5%"><a href="http://www.alangerber.us"><img src="https://avatars.githubusercontent.com/u/201313?v=4?s=100" width="100px;" alt="Alan Gerber"/><br /><sub><b>Alan Gerber</b></sub></a><br /><a href="#content-akgerber" title="Content">🖋</a></td>
295+
<td align="center" valign="top" width="12.5%"><a href="http://esotuvaka.github.io"><img src="https://avatars.githubusercontent.com/u/104941850?v=4?s=100" width="100px;" alt="Eric"/><br /><sub><b>Eric</b></sub></a><br /><a href="#content-esotuvaka" title="Content">🖋</a></td>
291296
</tr>
292297
</tbody>
293298
</table>

exercises/smart_pointers/cow1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ mod tests {
5252
fn owned_no_mutation() -> Result<(), &'static str> {
5353
// We can also pass `slice` without `&` so Cow owns it directly.
5454
// In this case no mutation occurs and thus also no clone,
55-
// but the result is still owned because it always was.
55+
// but the result is still owned because it was never borrowed
56+
// or mutated.
5657
let slice = vec![0, 1, 2];
5758
let mut input = Cow::from(slice);
5859
match abs_all(&mut input) {

src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,21 @@ fn spawn_watch_shell(
298298
println!("Bye!");
299299
} else if input.eq("help") {
300300
println!("Commands available to you in watch mode:");
301-
println!(" hint - prints the current exercise's hint");
302-
println!(" clear - clears the screen");
303-
println!(" quit - quits watch mode");
304-
println!(" help - displays this help message");
301+
println!(" hint - prints the current exercise's hint");
302+
println!(" clear - clears the screen");
303+
println!(" quit - quits watch mode");
304+
println!(" !<cmd> - executes a command, like `!rustc --explain E0381`");
305+
println!(" help - displays this help message");
305306
println!();
306307
println!("Watch mode automatically re-evaluates the current exercise");
307308
println!("when you edit a file's contents.")
309+
} else if let Some(cmd) = input.strip_prefix('!') {
310+
let parts: Vec<&str> = cmd.split_whitespace().collect();
311+
if parts.is_empty() {
312+
println!("no command provided");
313+
} else if let Err(e) = Command::new(parts[0]).args(&parts[1..]).status() {
314+
println!("failed to execute command `{}`: {}", cmd, e);
315+
}
308316
} else {
309317
println!("unknown command: {input}");
310318
}

0 commit comments

Comments
 (0)