Skip to content

Commit 0d59d1d

Browse files
committed
Rename to needless_return_with_question_mark
1 parent c13cb54 commit 0d59d1d

8 files changed

+13
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5093,7 +5093,7 @@ Released 2018-09-13
50935093
[`needless_raw_string_hashes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
50945094
[`needless_raw_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_strings
50955095
[`needless_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
5096-
[`needless_return_with_try`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return_with_try
5096+
[`needless_return_with_question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return_with_question_mark
50975097
[`needless_splitn`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_splitn
50985098
[`needless_update`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_update
50995099
[`neg_cmp_op_on_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#neg_cmp_op_on_partial_ord

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
569569
crate::return_self_not_must_use::RETURN_SELF_NOT_MUST_USE_INFO,
570570
crate::returns::LET_AND_RETURN_INFO,
571571
crate::returns::NEEDLESS_RETURN_INFO,
572-
crate::returns::NEEDLESS_RETURN_WITH_TRY_INFO,
572+
crate::returns::NEEDLESS_RETURN_WITH_QUESTION_MARK_INFO,
573573
crate::same_name_method::SAME_NAME_METHOD_INFO,
574574
crate::self_named_constructors::SELF_NAMED_CONSTRUCTORS_INFO,
575575
crate::semicolon_block::SEMICOLON_INSIDE_BLOCK_INFO,

clippy_lints/src/returns.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then, span_lint_hir_and_then};
22
use clippy_utils::source::{snippet_opt, snippet_with_context};
33
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};
55
use core::ops::ControlFlow;
66
use if_chain::if_chain;
77
use 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

163163
impl<'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",

tests/ui/needless_return_with_try.fixed renamed to tests/ui/needless_return_with_question_mark.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
//@aux-build:proc_macros.rs
2+
//@aux-build:proc_macros.rs:proc-macro
33
#![allow(
44
clippy::needless_return,
55
clippy::no_effect,

tests/ui/needless_return_with_try.rs renamed to tests/ui/needless_return_with_question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
//@aux-build:proc_macros.rs
2+
//@aux-build:proc_macros.rs:proc-macro
33
#![allow(
44
clippy::needless_return,
55
clippy::no_effect,
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error: unneeded `return` statement with `?` operator
2-
--> $DIR/needless_return_with_try.rs:28:5
2+
--> $DIR/needless_return_with_question_mark.rs:28:5
33
|
44
LL | return Err(())?;
55
| ^^^^^^^ help: remove it
66
|
7-
= note: `-D clippy::needless-return-with-try` implied by `-D warnings`
7+
= note: `-D clippy::needless-return-with-question-mark` implied by `-D warnings`
88

99
error: aborting due to previous error
1010

tests/ui/try_err.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![allow(
66
clippy::unnecessary_wraps,
77
clippy::needless_question_mark,
8-
clippy::needless_return_with_try
8+
clippy::needless_return_with_question_mark
99
)]
1010

1111
extern crate proc_macros;

tests/ui/try_err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![allow(
66
clippy::unnecessary_wraps,
77
clippy::needless_question_mark,
8-
clippy::needless_return_with_try
8+
clippy::needless_return_with_question_mark
99
)]
1010

1111
extern crate proc_macros;

0 commit comments

Comments
 (0)