Skip to content

Commit 6985e65

Browse files
committed
Auto merge of #9028 - kyoto7250:issue_8798, r=xFrednet
confirm using chain in collapsible_span_lint_calls close #8798 This PR fixes false positive when using chain in `collapsible_span_lint_calls`. changelog: None
2 parents 3d366fc + 4a4b5cf commit 6985e65

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

clippy_lints/src/utils/internal_lints.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls {
668668
let body = cx.tcx.hir().body(*body);
669669
let only_expr = peel_blocks_with_stmt(&body.value);
670670
if let ExprKind::MethodCall(ps, span_call_args, _) = &only_expr.kind;
671+
if let ExprKind::Path(..) = span_call_args[0].kind;
671672
then {
672673
let and_then_snippets = get_and_then_snippets(cx, and_then_args);
673674
let mut sle = SpanlessEq::new(cx).deny_side_effects();

tests/ui-internal/collapsible_span_lint_calls.fixed

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ impl EarlyLintPass for Pass {
4545
if predicate {
4646
db.note(note_msg);
4747
}
48-
})
48+
});
49+
50+
// Issue #8798
51+
span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
52+
db.help(help_msg).help(help_msg);
53+
});
4954
}
5055
}
5156

tests/ui-internal/collapsible_span_lint_calls.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ impl EarlyLintPass for Pass {
5555
if predicate {
5656
db.note(note_msg);
5757
}
58-
})
58+
});
59+
60+
// Issue #8798
61+
span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
62+
db.help(help_msg).help(help_msg);
63+
});
5964
}
6065
}
6166

0 commit comments

Comments
 (0)