-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Fix instructions(steps) for conversions/from_str exercice #626
Conversation
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.
Hi @jfchevrette, thanks for suggesting changes to this exercise. The changes you're adding will not work. The implementation of a trait should never panic. It should always return a Result
.
The #[should_panic]
directives you see in the test cases are there to make sure what when .unwrap()
is used on an erroneous Result
, the program should panic. The tests themselves can be updated to avoid the usage the .unwrap()
method and to remove the somewhat confusing #[should_panic]
directives. I am more than happy to review and approve this PR if you take that on.
Please let me know if you have any questions.
Thanks,
Abdou
@AbdouSeck Thank you for the detailed response and for being welcoming and patient with new contributors. This is my first contribution to the rust ecosystem and it is nice to see such kindness. I have changed my PR following your guidance. I hope it meets expectations now. What I did was remove the I also changed the steps instructions a bit again. I mostly added clarification/hints at the newer tests which were added recently Please let me know what you think and advise if you feel there's additional changes needed. Thanks! |
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.
@jfchevrette the tests look great. Thanks for updating them and for adding clarifications to the instructions.
@all-contributors please add @jfchevrette for content and code |
@fmoko I've put up a pull request to add @jfchevrette! 🎉 |
Fix instructions(steps) for conversions/from_str exercice
Fix instructions(steps) for conversions/from_str exercice
The steps currently tell the user to return an error but the tests check for panic.
This updates the instructions to make it clearer that if the extraction/parsing fails, a panic should be raised