fix [manual_unwrap_or_default] suggestion ignoring side-effects#12579
fix [manual_unwrap_or_default] suggestion ignoring side-effects#12579bors merged 1 commit intorust-lang:masterfrom
manual_unwrap_or_default] suggestion ignoring side-effects#12579Conversation
|
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
497d2e2 to
9cafdbd
Compare
| "replace it with", | ||
| format!("{receiver}.unwrap_or_default()"), | ||
| Applicability::MachineApplicable, | ||
| Applicability::MaybeIncorrect, |
There was a problem hiding this comment.
Would be a shame to lose --fix in cases where it is appropriate, could set the applicability based on https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.span_contains_comment.html
There was a problem hiding this comment.
thanks, forgot that I can do that
(kinda want to do some refractoring, having to put same code in different place everytime (same as #12566) is a little bit annoying lol)
|
Thanks! @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
|
I'm still getting a false positive with this lint with rustc 1.79.0-nightly (88c2f4f 2024-04-02): |
|
@jqnatividad This fix is not on nightly yet, since the clippy submodule in the rust-lang/rust repo (where the clippy rustup component is built from) is only updated every 2 weeks. You can also clone the clippy repo locally and run |
fixes: #12569
closes: #12580
change applicability to
MaybeIncorrectwhen the expression contains a comment base on suggestion in this zulip discussionchangelog: fix [
manual_unwrap_or_default] suggestion ignoring side-effects, and adjust its applicability.