@@ -3,7 +3,7 @@ use crate::question_mark_used::QUESTION_MARK_USED;
3
3
use clippy_config:: Conf ;
4
4
use clippy_config:: types:: MatchLintBehaviour ;
5
5
use clippy_utils:: diagnostics:: span_lint_and_sugg;
6
- use clippy_utils:: msrvs:: Msrv ;
6
+ use clippy_utils:: msrvs:: { self , Msrv } ;
7
7
use clippy_utils:: source:: snippet_with_applicability;
8
8
use clippy_utils:: ty:: { implements_trait, is_type_diagnostic_item} ;
9
9
use clippy_utils:: {
@@ -524,7 +524,8 @@ fn is_inferred_ret_closure(expr: &Expr<'_>) -> bool {
524
524
525
525
impl < ' tcx > LateLintPass < ' tcx > for QuestionMark {
526
526
fn check_stmt ( & mut self , cx : & LateContext < ' tcx > , stmt : & ' tcx Stmt < ' _ > ) {
527
- if !is_lint_allowed ( cx, QUESTION_MARK_USED , stmt. hir_id ) {
527
+ if !is_lint_allowed ( cx, QUESTION_MARK_USED , stmt. hir_id ) || !self . msrv . meets ( cx, msrvs:: QUESTION_MARK_OPERATOR )
528
+ {
528
529
return ;
529
530
}
530
531
@@ -540,7 +541,10 @@ impl<'tcx> LateLintPass<'tcx> for QuestionMark {
540
541
return ;
541
542
}
542
543
543
- if !self . inside_try_block ( ) && !is_in_const_context ( cx) && is_lint_allowed ( cx, QUESTION_MARK_USED , expr. hir_id )
544
+ if !self . inside_try_block ( )
545
+ && !is_in_const_context ( cx)
546
+ && is_lint_allowed ( cx, QUESTION_MARK_USED , expr. hir_id )
547
+ && self . msrv . meets ( cx, msrvs:: QUESTION_MARK_OPERATOR )
544
548
{
545
549
check_is_none_or_err_and_early_return ( cx, expr) ;
546
550
check_if_let_some_or_err_and_early_return ( cx, expr) ;
0 commit comments