-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 false-positive manual_unwrap_or
inside const fn
#6917
Fix false-positive manual_unwrap_or
inside const fn
#6917
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (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. Due to 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. |
clippy_lints/src/manual_unwrap_or.rs
Outdated
lint_manual_unwrap_or(cx, expr); | ||
if_chain! { | ||
if let FnKind::ItemFn(_, _, header, _) = kind; | ||
if !header.is_const(); |
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.
I think it would be better to use in_constant
in this case:
rust-clippy/clippy_utils/src/lib.rs
Line 199 in 1a206fc
pub fn in_constant(cx: &LateContext<'_>, id: HirId) -> bool { |
gonna r? @giraffate unless you want me to review this :) It looks okay at a glance! |
@bors delegate+ |
✌️ @MysteryJump can now approve this pull request |
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.
This looks good to me. Thanks!
@bors delegate=giraffate r=giraffate oops, forgot delegate doesn't work that way, sorry @giraffate |
✌️ @giraffate can now approve this pull request |
📌 Commit 02ceeb5 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
…-fn, r=giraffate Fix false-positive `manual_unwrap_or` inside const fn Fixes rust-lang#6898 changelog: Fix false-positive for manual_unwrap_or in const fn.
Fixes #6898
changelog: Fix false-positive for manual_unwrap_or in const fn.