about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkyoto7250 <50972773+kyoto7250@users.noreply.github.com>2022-06-20 13:17:54 +0900
committerkyoto7250 <50972773+kyoto7250@users.noreply.github.com>2022-06-20 13:17:54 +0900
commit4a4b5cf06153d8e8702ea5105d777d4822871edf (patch)
treeb9c2acd49f789220496a3e5add90e27a364e3698
parente933bb6bc3d7e15cbdbcbc44f7e94c2bde53c450 (diff)
downloadrust-4a4b5cf06153d8e8702ea5105d777d4822871edf.tar.gz
rust-4a4b5cf06153d8e8702ea5105d777d4822871edf.zip
confirm using chain in collapsible_span_lint_calls
-rw-r--r--clippy_lints/src/utils/internal_lints.rs1
-rw-r--r--tests/ui-internal/collapsible_span_lint_calls.fixed7
-rw-r--r--tests/ui-internal/collapsible_span_lint_calls.rs7
3 files changed, 13 insertions, 2 deletions
diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs
index b885e5132f1..36a85b0869f 100644
--- a/clippy_lints/src/utils/internal_lints.rs
+++ b/clippy_lints/src/utils/internal_lints.rs
@@ -668,6 +668,7 @@ impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls {
             let body = cx.tcx.hir().body(*body);
             let only_expr = peel_blocks_with_stmt(&body.value);
             if let ExprKind::MethodCall(ps, span_call_args, _) = &only_expr.kind;
+            if let ExprKind::Path(..) = span_call_args[0].kind;
             then {
                 let and_then_snippets = get_and_then_snippets(cx, and_then_args);
                 let mut sle = SpanlessEq::new(cx).deny_side_effects();
diff --git a/tests/ui-internal/collapsible_span_lint_calls.fixed b/tests/ui-internal/collapsible_span_lint_calls.fixed
index a5a6f20ddd5..9f299d7dec7 100644
--- a/tests/ui-internal/collapsible_span_lint_calls.fixed
+++ b/tests/ui-internal/collapsible_span_lint_calls.fixed
@@ -45,7 +45,12 @@ impl EarlyLintPass for Pass {
             if predicate {
                 db.note(note_msg);
             }
-        })
+        });
+
+        // Issue #8798
+        span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
+            db.help(help_msg).help(help_msg);
+        });
     }
 }
 
diff --git a/tests/ui-internal/collapsible_span_lint_calls.rs b/tests/ui-internal/collapsible_span_lint_calls.rs
index 6d783aa0786..2b113f555e4 100644
--- a/tests/ui-internal/collapsible_span_lint_calls.rs
+++ b/tests/ui-internal/collapsible_span_lint_calls.rs
@@ -55,7 +55,12 @@ impl EarlyLintPass for Pass {
             if predicate {
                 db.note(note_msg);
             }
-        })
+        });
+
+        // Issue #8798
+        span_lint_and_then(cx, TEST_LINT, expr.span, lint_msg, |db| {
+            db.help(help_msg).help(help_msg);
+        });
     }
 }