Merge branch 'main' into patch-2

This commit is contained in:
Aaron Wang 2023-05-01 19:10:56 -04:00 committed by GitHub
commit d3fea5f15a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 5 deletions

View File

@ -2037,6 +2037,33 @@
"contributions": [ "contributions": [
"content" "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, "contributorsPerLine": 8,

View File

@ -288,6 +288,11 @@ authors.
<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> <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>
<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> <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>
<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> <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>
<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>
</tr>
<tr>
<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>
<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>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -52,7 +52,8 @@ mod tests {
fn owned_no_mutation() -> Result<(), &'static str> { fn owned_no_mutation() -> Result<(), &'static str> {
// We can also pass `slice` without `&` so Cow owns it directly. // We can also pass `slice` without `&` so Cow owns it directly.
// In this case no mutation occurs and thus also no clone, // 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 slice = vec![0, 1, 2];
let mut input = Cow::from(slice); let mut input = Cow::from(slice);
match abs_all(&mut input) { match abs_all(&mut input) {

View File

@ -298,13 +298,21 @@ fn spawn_watch_shell(
println!("Bye!"); println!("Bye!");
} else if input.eq("help") { } else if input.eq("help") {
println!("Commands available to you in watch mode:"); println!("Commands available to you in watch mode:");
println!(" hint - prints the current exercise's hint"); println!(" hint - prints the current exercise's hint");
println!(" clear - clears the screen"); println!(" clear - clears the screen");
println!(" quit - quits watch mode"); println!(" quit - quits watch mode");
println!(" help - displays this help message"); println!(" !<cmd> - executes a command, like `!rustc --explain E0381`");
println!(" help - displays this help message");
println!(); println!();
println!("Watch mode automatically re-evaluates the current exercise"); println!("Watch mode automatically re-evaluates the current exercise");
println!("when you edit a file's contents.") 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 { } else {
println!("unknown command: {input}"); println!("unknown command: {input}");
} }