mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Added check for local spans
This commit is contained in:
parent
89314a0805
commit
09337981b2
@ -1,5 +1,6 @@
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
|
||||
use clippy_utils::macros::span_is_local;
|
||||
use rustc_hir::{Expr, ExprKind, MatchSource};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
@ -34,6 +35,10 @@ declare_lint_pass!(QuestionMarkUsed => [QUESTION_MARK_USED]);
|
||||
impl<'tcx> LateLintPass<'tcx> for QuestionMarkUsed {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
if let ExprKind::Match(_, _, MatchSource::TryDesugar) = expr.kind {
|
||||
if !span_is_local(expr.span) {
|
||||
return;
|
||||
}
|
||||
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
QUESTION_MARK_USED,
|
||||
|
Loading…
Reference in New Issue
Block a user