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,7 +113,7 @@ declare_clippy_lint! {
113113 /// }
114114 /// ```
115115 #[ clippy:: version = "1.72.0" ]
116- pub NEEDLESS_RETURN_WITH_TRY ,
116+ pub NEEDLESS_RETURN_WITH_QUESTION_MARK ,
117117 style,
118118 "using a return statement like `return Err(expr)?;` where removing it would suffice"
119119}
@@ -157,7 +157,7 @@ impl<'tcx> ToString for RetReplacement<'tcx> {
157157 }
158158}
159159
160- declare_lint_pass ! ( Return => [ LET_AND_RETURN , NEEDLESS_RETURN , NEEDLESS_RETURN_WITH_TRY ] ) ;
160+ declare_lint_pass ! ( Return => [ LET_AND_RETURN , NEEDLESS_RETURN , NEEDLESS_RETURN_WITH_QUESTION_MARK ] ) ;
161161
162162impl < ' tcx > LateLintPass < ' tcx > for Return {
163163 fn check_stmt ( & mut self , cx : & LateContext < ' tcx > , stmt : & ' tcx Stmt < ' _ > ) {
@@ -176,7 +176,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
176176 {
177177 span_lint_and_sugg (
178178 cx,
179- NEEDLESS_RETURN_WITH_TRY ,
179+ NEEDLESS_RETURN_WITH_QUESTION_MARK ,
180180 expr. span . until ( ret. span ) ,
181181 "unneeded `return` statement with `?` operator" ,
182182 "remove it" ,
0 commit comments