Skip to content

Commit 0933798

Browse files
committed
Added check for local spans
1 parent 89314a0 commit 0933798

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clippy_lints/src/question_mark_used.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22

3+
use clippy_utils::macros::span_is_local;
34
use rustc_hir::{Expr, ExprKind, MatchSource};
45
use rustc_lint::{LateContext, LateLintPass};
56
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -34,6 +35,10 @@ declare_lint_pass!(QuestionMarkUsed => [QUESTION_MARK_USED]);
3435
impl<'tcx> LateLintPass<'tcx> for QuestionMarkUsed {
3536
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
3637
if let ExprKind::Match(_, _, MatchSource::TryDesugar) = expr.kind {
38+
if !span_is_local(expr.span) {
39+
return;
40+
}
41+
3742
span_lint_and_help(
3843
cx,
3944
QUESTION_MARK_USED,

0 commit comments

Comments
 (0)