-
Notifications
You must be signed in to change notification settings - Fork 464
rust: module.rs: Replace unwrap() with expect() #142
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
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.
Thanks for the PR!
5580453
to
6c960e8
Compare
6c960e8
to
77b3155
Compare
rust/module.rs
Outdated
@@ -673,5 +677,5 @@ pub fn module(ts: TokenStream) -> TokenStream { | |||
params_modinfo = params_modinfo, | |||
generated_array_types = generated_array_types, | |||
initcall_section = ".initcall6.init" | |||
).parse().unwrap() | |||
).parse().expect("LexError returned whle trying to parse the string token stream.") |
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.
Typo:
).parse().expect("LexError returned whle trying to parse the string token stream.") | |
).parse().expect("LexError returned while trying to parse the string token stream") |
Also, perhaps we can just say:
Error parsing formatted string into token stream
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.
Thanks! I made the changes.
Use expect() instead of unwrap() to add more details about the error in case of a panic. Fixes torvalds#90. Signed-off-by: Sumera Priyadarsini <[email protected]>
Signed-off-by: Sumera Priyadarsini <[email protected]>
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.
LGTM!
Thanks a lot! :-) |
Use expect() instead of unwrap() to add more details
about the error in case of a panic.
Fixes #90.
Signed-off-by: Sumera Priyadarsini [email protected]