We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89314a0 commit 0933798Copy full SHA for 0933798
clippy_lints/src/question_mark_used.rs
@@ -1,5 +1,6 @@
1
use clippy_utils::diagnostics::span_lint_and_help;
2
3
+use clippy_utils::macros::span_is_local;
4
use rustc_hir::{Expr, ExprKind, MatchSource};
5
use rustc_lint::{LateContext, LateLintPass};
6
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -34,6 +35,10 @@ declare_lint_pass!(QuestionMarkUsed => [QUESTION_MARK_USED]);
34
35
impl<'tcx> LateLintPass<'tcx> for QuestionMarkUsed {
36
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
37
if let ExprKind::Match(_, _, MatchSource::TryDesugar) = expr.kind {
38
+ if !span_is_local(expr.span) {
39
+ return;
40
+ }
41
+
42
span_lint_and_help(
43
cx,
44
QUESTION_MARK_USED,
0 commit comments