Address feedback

This commit is contained in:
marisa 2019-11-11 17:47:45 +01:00
parent 48c35bcfbc
commit 1a7bb5a400
5 changed files with 7 additions and 13 deletions

View File

@ -13,7 +13,7 @@
// type goes where the question marks are, and how do we return // type goes where the question marks are, and how do we return
// that type from the body of read_and_validate? // 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 // I AM NOT DONE

View File

@ -1,5 +1,5 @@
// result1.rs // 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 // I AM NOT DONE

View File

@ -1,5 +1,5 @@
// functions1.rs // functions1.rs
// Make me compile! Execute `rustlings hint function1` for hints :) // Make me compile! Execute `rustlings hint functions1` for hints :)
// I AM NOT DONE // I AM NOT DONE

View File

@ -456,7 +456,7 @@ hint = """
If other functions can return a `Result`, why shouldn't `main`?""" If other functions can return a `Result`, why shouldn't `main`?"""
[[exercises]] [[exercises]]
name = "errors4" name = "errorsn"
path = "exercises/error_handling/errorsn.rs" path = "exercises/error_handling/errorsn.rs"
mode = "test" mode = "test"
hint = """ 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!""" a `Some` value and only print out something if we have a value!"""
[[exercises]] [[exercises]]
name = "option2" name = "result1"
path = "exercises/error_handling/result1.rs" path = "exercises/error_handling/result1.rs"
mode = "test" mode = "test"
hint = """ hint = """

View File

@ -60,10 +60,7 @@ fn main() {
let exercises = toml::from_str::<ExerciseList>(toml_str).unwrap().exercises; let exercises = toml::from_str::<ExerciseList>(toml_str).unwrap().exercises;
if let Some(ref matches) = matches.subcommand_matches("run") { if let Some(ref matches) = matches.subcommand_matches("run") {
let name = matches.value_of("name").unwrap_or_else(|| { let name = matches.value_of("name").unwrap();
println!("Please supply an exercise name!");
std::process::exit(1);
});
let matching_exercise = |e: &&Exercise| name == e.name; let matching_exercise = |e: &&Exercise| name == e.name;
@ -76,10 +73,7 @@ fn main() {
} }
if let Some(ref matches) = matches.subcommand_matches("hint") { if let Some(ref matches) = matches.subcommand_matches("hint") {
let name = matches.value_of("name").unwrap_or_else(|| { let name = matches.value_of("name").unwrap();
println!("Please supply an exercise name!");
std::process::exit(1);
});
let exercise = exercises let exercise = exercises
.iter() .iter()