1
1
use clippy_utils:: diagnostics:: { span_lint_and_sugg, span_lint_and_then, span_lint_hir_and_then} ;
2
2
use clippy_utils:: source:: { snippet_opt, snippet_with_context} ;
3
3
use 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} ;
5
5
use core:: ops:: ControlFlow ;
6
6
use if_chain:: if_chain;
7
7
use rustc_errors:: Applicability ;
@@ -113,8 +113,8 @@ declare_clippy_lint! {
113
113
/// Ok(())
114
114
/// }
115
115
/// ```
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 ,
118
118
style,
119
119
"using a return statement like `return Err(expr)?;` where removing it would suffice"
120
120
}
@@ -158,7 +158,7 @@ impl<'tcx> ToString for RetReplacement<'tcx> {
158
158
}
159
159
}
160
160
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 ] ) ;
162
162
163
163
impl < ' tcx > LateLintPass < ' tcx > for Return {
164
164
fn check_stmt ( & mut self , cx : & LateContext < ' tcx > , stmt : & ' tcx Stmt < ' _ > ) {
@@ -177,7 +177,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
177
177
{
178
178
span_lint_and_sugg (
179
179
cx,
180
- NEEDLESS_RETURN_WITH_TRY ,
180
+ NEEDLESS_RETURN_WITH_QUESTION_MARK ,
181
181
expr. span . until ( ret. span ) ,
182
182
"unneeded `return` statement with `?` operator" ,
183
183
"remove it" ,
0 commit comments