mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-11-08 09:09:17 +01:00
Address feedback
This commit is contained in:
parent
48c35bcfbc
commit
1a7bb5a400
@ -13,7 +13,7 @@
|
||||
// type goes where the question marks are, and how do we return
|
||||
// that type from the body of read_and_validate?
|
||||
//
|
||||
// Execute `rustlings hint errors4` for hints :)
|
||||
// Execute `rustlings hint errorsn` for hints :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// result1.rs
|
||||
// Make this test pass! Execute `rustlings hint option2` for hints :)
|
||||
// Make this test pass! Execute `rustlings hint result1` for hints :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// functions1.rs
|
||||
// Make me compile! Execute `rustlings hint function1` for hints :)
|
||||
// Make me compile! Execute `rustlings hint functions1` for hints :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
@ -456,7 +456,7 @@ hint = """
|
||||
If other functions can return a `Result`, why shouldn't `main`?"""
|
||||
|
||||
[[exercises]]
|
||||
name = "errors4"
|
||||
name = "errorsn"
|
||||
path = "exercises/error_handling/errorsn.rs"
|
||||
mode = "test"
|
||||
hint = """
|
||||
@ -507,7 +507,7 @@ Or use an `if let` statement on the result of `pop()` to both destructure
|
||||
a `Some` value and only print out something if we have a value!"""
|
||||
|
||||
[[exercises]]
|
||||
name = "option2"
|
||||
name = "result1"
|
||||
path = "exercises/error_handling/result1.rs"
|
||||
mode = "test"
|
||||
hint = """
|
||||
|
10
src/main.rs
10
src/main.rs
@ -60,10 +60,7 @@ fn main() {
|
||||
let exercises = toml::from_str::<ExerciseList>(toml_str).unwrap().exercises;
|
||||
|
||||
if let Some(ref matches) = matches.subcommand_matches("run") {
|
||||
let name = matches.value_of("name").unwrap_or_else(|| {
|
||||
println!("Please supply an exercise name!");
|
||||
std::process::exit(1);
|
||||
});
|
||||
let name = matches.value_of("name").unwrap();
|
||||
|
||||
let matching_exercise = |e: &&Exercise| name == e.name;
|
||||
|
||||
@ -76,10 +73,7 @@ fn main() {
|
||||
}
|
||||
|
||||
if let Some(ref matches) = matches.subcommand_matches("hint") {
|
||||
let name = matches.value_of("name").unwrap_or_else(|| {
|
||||
println!("Please supply an exercise name!");
|
||||
std::process::exit(1);
|
||||
});
|
||||
let name = matches.value_of("name").unwrap();
|
||||
|
||||
let exercise = exercises
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user