diff options
Diffstat (limited to 'exercises/error_handling/errors1.rs')
| -rw-r--r-- | exercises/error_handling/errors1.rs | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/exercises/error_handling/errors1.rs b/exercises/error_handling/errors1.rs index 8483234..f585e29 100644 --- a/exercises/error_handling/errors1.rs +++ b/exercises/error_handling/errors1.rs @@ -4,7 +4,7 @@ // was, instead of just sometimes returning `None`. The 2nd test currently // does not compile or pass, but it illustrates the behavior we would like // this function to have. -// Scroll down for hints!!! +// Execute `rustlings hint errors1` for hints! pub fn generate_nametag_text(name: String) -> Option<String> { if name.len() > 0 { @@ -38,36 +38,3 @@ mod tests { ); } } - - - - - - - - - - - - - - - - - - - - -// `Err` is one of the variants of `Result`, so what the 2nd test is saying -// is that `generate_nametag_text` should return a `Result` instead of an -// `Option`. - -// To make this change, you'll need to: -// - update the return type in the function signature to be a Result<String, String> that -// could be the variants `Ok(String)` and `Err(String)` -// - change the body of the function to return `Ok(stuff)` where it currently -// returns `Some(stuff)` -// - change the body of the function to return `Err(error message)` where it -// currently returns `None` -// - change the first test to expect `Ok(stuff)` where it currently expects -// `Some(stuff)`. |
