-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix significant_drop_tightening
: don't suggest when missing the necessary spans
#15598
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
base: master
Are you sure you want to change the base?
Conversation
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
r? clippy |
03a2c76
to
e4797f5
Compare
Lintcheck changes for 646705a
This comment will be updated if you push new changes |
Uhh, that doesn't look right.. |
1809efa
to
e6f19ec
Compare
significant_drop_tightening
: don't suggest when not having the necessary spanssignificant_drop_tightening
: don't suggest when missing the necessary spans
e6f19ec
to
3e414c4
Compare
Much better |
); | ||
}, | ||
} else { | ||
diag.help("merge the temporary construction with its single usage"); |
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'm not sure whether I should turn this into span_help
, given that the span this points at is imprecise -- it shows the span in which the lock is used, and not the exact place that the temporary construction should be merged into
7db57b0
to
92b0021
Compare
|
||
fn has_drop(expr: &hir::Expr<'_>, first_bind_ident: Option<Ident>, lcx: &LateContext<'_>) -> bool { | ||
if let hir::ExprKind::Call(fun, [first_arg]) = expr.kind | ||
if let Some(first_bind_ident) = first_bind_ident |
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.
Since you're changing this the function shouldn't even take an Option
here.
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's appropriate in this case, because apa.first_bind_ident
is an Option<Ident>
as well, no?
92b0021
to
eb438b7
Compare
This comment has been minimized.
This comment has been minimized.
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
eb438b7
to
ee374fe
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Thank you. Just needs to be rebased.
ee374fe
to
646705a
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This improves the situation in #15574 a bit: instead of making a wrong suggestion, we give a correct, albeit imprecise, help message -- notice how its span doesn't point exactly at the "heavy" type, but just the statement it's located in.
I initially wanted to implement this by replacing
DUMMY_SP
withNone
, but there are some other places in the code where the former is used which are hard to get rid of (for exampledummy_stmt_expr
, which is fishy in and of itself), so I resorted to checkingis_dummy
before emitting the suggestion.changelog: [
significant_drop_tightening
]: don't suggest when missing the necessary spans