mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
Merge branch 'main' into patch-2
This commit is contained in:
commit
d3fea5f15a
|
@ -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,
|
||||
|
|
|
@ -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://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="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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -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) {
|
||||
|
|
16
src/main.rs
16
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!(" !<cmd> - 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}");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue