@@ -4,14 +4,15 @@ use clippy_config::Conf;
44use clippy_config:: types:: MatchLintBehaviour ;
55use clippy_utils:: diagnostics:: span_lint_and_sugg;
66use clippy_utils:: msrvs:: { self , Msrv } ;
7+ use clippy_utils:: res:: MaybeQPath ;
78use clippy_utils:: source:: snippet_with_applicability;
89use clippy_utils:: sugg:: Sugg ;
910use clippy_utils:: ty:: { implements_trait, is_copy, is_type_diagnostic_item} ;
1011use clippy_utils:: usage:: local_used_after_expr;
1112use clippy_utils:: {
1213 eq_expr_value, fn_def_id_with_node_args, higher, is_else_clause, is_in_const_context, is_lint_allowed,
13- is_path_lang_item , is_res_lang_ctor, pat_and_expr_can_be_question_mark, path_res, path_to_local, path_to_local_id,
14- peel_blocks , peel_blocks_with_stmt, span_contains_cfg, span_contains_comment, sym,
14+ is_res_lang_ctor, pat_and_expr_can_be_question_mark, path_res, path_to_local, path_to_local_id, peel_blocks ,
15+ peel_blocks_with_stmt, span_contains_cfg, span_contains_comment, sym,
1516} ;
1617use rustc_errors:: Applicability ;
1718use rustc_hir:: LangItem :: { self , OptionNone , OptionSome , ResultErr , ResultOk } ;
@@ -521,11 +522,11 @@ impl QuestionMark {
521522 }
522523}
523524
524- fn is_try_block ( cx : & LateContext < ' _ > , bl : & Block < ' _ > ) -> bool {
525+ fn is_try_block ( bl : & Block < ' _ > ) -> bool {
525526 if let Some ( expr) = bl. expr
526527 && let ExprKind :: Call ( callee, [ _] ) = expr. kind
527528 {
528- is_path_lang_item ( cx , callee , LangItem :: TryTraitFromOutput )
529+ callee . opt_lang_path ( ) == Some ( LangItem :: TryTraitFromOutput )
529530 } else {
530531 false
531532 }
@@ -581,8 +582,8 @@ impl<'tcx> LateLintPass<'tcx> for QuestionMark {
581582 }
582583 }
583584
584- fn check_block ( & mut self , cx : & LateContext < ' tcx > , block : & ' tcx Block < ' tcx > ) {
585- if is_try_block ( cx , block) {
585+ fn check_block ( & mut self , _ : & LateContext < ' tcx > , block : & ' tcx Block < ' tcx > ) {
586+ if is_try_block ( block) {
586587 * self
587588 . try_block_depth_stack
588589 . last_mut ( )
@@ -598,8 +599,8 @@ impl<'tcx> LateLintPass<'tcx> for QuestionMark {
598599 self . try_block_depth_stack . pop ( ) ;
599600 }
600601
601- fn check_block_post ( & mut self , cx : & LateContext < ' tcx > , block : & ' tcx Block < ' tcx > ) {
602- if is_try_block ( cx , block) {
602+ fn check_block_post ( & mut self , _ : & LateContext < ' tcx > , block : & ' tcx Block < ' tcx > ) {
603+ if is_try_block ( block) {
603604 * self
604605 . try_block_depth_stack
605606 . last_mut ( )
0 commit comments