11use clippy_utils:: diagnostics:: { span_lint_and_sugg, span_lint_and_then, span_lint_hir_and_then} ;
22use clippy_utils:: source:: { snippet_opt, snippet_with_context} ;
33use clippy_utils:: visitors:: { for_each_expr_with_closures, Descend } ;
4- use clippy_utils:: { fn_def_id, path_to_local_id, span_find_starting_semi} ;
4+ use clippy_utils:: { fn_def_id, is_from_proc_macro , path_to_local_id, span_find_starting_semi} ;
55use core:: ops:: ControlFlow ;
66use if_chain:: if_chain;
77use rustc_errors:: Applicability ;
@@ -113,8 +113,8 @@ declare_clippy_lint! {
113113 /// Ok(())
114114 /// }
115115 /// ```
116- #[ clippy:: version = "1.72 .0" ]
117- pub NEEDLESS_RETURN_WITH_TRY ,
116+ #[ clippy:: version = "1.73 .0" ]
117+ pub NEEDLESS_RETURN_WITH_QUESTION_MARK ,
118118 style,
119119 "using a return statement like `return Err(expr)?;` where removing it would suffice"
120120}
@@ -158,7 +158,7 @@ impl<'tcx> ToString for RetReplacement<'tcx> {
158158 }
159159}
160160
161- declare_lint_pass ! ( Return => [ LET_AND_RETURN , NEEDLESS_RETURN , NEEDLESS_RETURN_WITH_TRY ] ) ;
161+ declare_lint_pass ! ( Return => [ LET_AND_RETURN , NEEDLESS_RETURN , NEEDLESS_RETURN_WITH_QUESTION_MARK ] ) ;
162162
163163impl < ' tcx > LateLintPass < ' tcx > for Return {
164164 fn check_stmt ( & mut self , cx : & LateContext < ' tcx > , stmt : & ' tcx Stmt < ' _ > ) {
@@ -177,7 +177,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
177177 {
178178 span_lint_and_sugg (
179179 cx,
180- NEEDLESS_RETURN_WITH_TRY ,
180+ NEEDLESS_RETURN_WITH_QUESTION_MARK ,
181181 expr. span . until ( ret. span ) ,
182182 "unneeded `return` statement with `?` operator" ,
183183 "remove it" ,
0 commit comments