-
Notifications
You must be signed in to change notification settings - Fork 111
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
Remove Problematic Unwraps In Macros #1055
Remove Problematic Unwraps In Macros #1055
Conversation
…can appear as a warning if the end users has this lint enabled https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_used
…rs If The User Has A Clippy Lint Active https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_used
…g/Error When A Clippy Lint Is Active: https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_used
|
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.
As far as I can tell this lint only complains about unwraps, and .exepct()
is fine.
Imo if we are sure that .unwraps() can't fail, then they should remain panicking - because triggering this panic means a programming error on our part which should be reported and fixed. Unless @wprzytula disagrees, could you change those unwraps to .expect
's with proper error messages?
Oh> As far as I can tell this lint only complains about unwraps, and
This is true, but it bubbles the problem up to the This is definitely preferable, but personally i would like to see it removed, just given that this code is expanded into users of the drivers code. Happy to change it if not panicking feels strange to you, i can absolutely understand the reason you have given, especially seeing as these are both optional lints |
I think it would be better to change it to expects, but let's wait for @wprzytula 's opinion before doing it. |
100%, we use
I fully agree. |
I think that's reasonable. I have one more alternative to suggest: If we use If you don't find this acceptable, i will implement the |
If someone enables this lint that means they don't want any
I think that would be the best solution. |
Then so it shall be :), will ping you when the change is made. |
@Lorak-mmk should be okay now. |
CI fail will be fixed by #1060 so we can ignore the fail here. |
@Lorak-mmk thank you for your time |
Using unwraps in macros means the code is compiled as part of the end users build.
This therefore means any lints a user uses will check the macro code as well.
These unwraps therefore the clippy lint
unwrap_used
will throw a warning/error if the user has enabled it.I wanted to enable this in a project that uses scylla, so i've created this merge request to try and fix this in the least invasive way possible.
I have returned error states where the unwraps were used, but if this feels more in the realm of a
panic
state, then it can simply be swapped forpanic
Pre-review checklist
./docs/source/
.Fixes:
annotations to PR description.