-
Notifications
You must be signed in to change notification settings - Fork 13.6k
doc: error-handling.md: main case analysis for search #29686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @BurntSushi |
println!("{}, {}: {:?}", pop.city, pop.country, pop.count); | ||
} | ||
} | ||
Err(err) => panic!("{}", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to println!("{}", err)
? I don't think there's any reason to panic here, which would present an ugly error message to the user.
@jrburke Looks good, thank you! I had one small nit, but otherwise this looks good to go. |
0ebf9ac
to
0dd2c1c
Compare
@BurntSushi I changed |
@bors r=BurntSushi rollup Thanks! |
📌 Commit 0dd2c1c has been approved by |
…ntSushi In src/doc/trpl/error-handling.md, in this section: It mentions three steps, to "convert this to proper error handling", the last one being: 3. Handle the error in main. However, it is not shown. This pull request adds a code example showing how `main`'s call to `search` should use case analysis. I am still very much new to learning Rust, so this may not be idiomatic. Happy to make changes with guidance.
In src/doc/trpl/error-handling.md, in this section:
Error handling with Box
It mentions three steps, to "convert this to proper error handling", the last one being:
However, it is not shown. This pull request adds a code example showing how
main
's call tosearch
should use case analysis. I am still very much new to learning Rust, so this may not be idiomatic. Happy to make changes with guidance.