-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Don't emit machine applicable map_flatten
lint if there are code comments
#13940
Don't emit machine applicable map_flatten
lint if there are code comments
#13940
Conversation
65cf751
to
fbc1f00
Compare
Fixed fmt error. |
@@ -17,10 +17,15 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, map_ | |||
let mut applicability = Applicability::MachineApplicable; | |||
|
|||
let closure_snippet = snippet_with_applicability(cx, map_arg.span, "..", &mut applicability); | |||
let span = expr.span.with_lo(map_span.lo()); | |||
// If the methods are separated with comments, we don't apply suggestion automatically. | |||
if applicability != Applicability::Unspecified && span_contains_comment(cx.tcx.sess.source_map(), span) { |
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.
Is it really useful to check for the very unlikely Unspecified
case here? Sure, it speeds things up a bit in case it matches, but what is the chance?
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 is unreachable afaict (snippet_with_applicability
never changes it to Unspecified
)
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 starting to suspect it will not even change it to HasPlaceholders
either (see #13941).
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 don't mind removing it if preferred.
fbc1f00
to
78225cc
Compare
Removed the |
Fixes #8528.
Similar to #13911, if there are code comments, we don't want to remove them automatically.
changelog: Don't emit machine applicable
map_flatten
lint if there are code commentsr? @xFrednet