Rename to needless_return_with_question_mark

This commit is contained in:
Catherine 2023-07-12 21:48:22 -05:00
parent c13cb54e25
commit 0d59d1d617
8 changed files with 13 additions and 13 deletions

View File

@ -5093,7 +5093,7 @@ Released 2018-09-13
[`needless_raw_string_hashes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
[`needless_raw_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_strings
[`needless_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
[`needless_return_with_try`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return_with_try
[`needless_return_with_question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return_with_question_mark
[`needless_splitn`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_splitn
[`needless_update`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_update
[`neg_cmp_op_on_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#neg_cmp_op_on_partial_ord

View File

@ -569,7 +569,7 @@
crate::return_self_not_must_use::RETURN_SELF_NOT_MUST_USE_INFO,
crate::returns::LET_AND_RETURN_INFO,
crate::returns::NEEDLESS_RETURN_INFO,
crate::returns::NEEDLESS_RETURN_WITH_TRY_INFO,
crate::returns::NEEDLESS_RETURN_WITH_QUESTION_MARK_INFO,
crate::same_name_method::SAME_NAME_METHOD_INFO,
crate::self_named_constructors::SELF_NAMED_CONSTRUCTORS_INFO,
crate::semicolon_block::SEMICOLON_INSIDE_BLOCK_INFO,

View File

@ -1,7 +1,7 @@
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then, span_lint_hir_and_then};
use clippy_utils::source::{snippet_opt, snippet_with_context};
use clippy_utils::visitors::{for_each_expr_with_closures, Descend};
use clippy_utils::{fn_def_id, path_to_local_id, span_find_starting_semi};
use clippy_utils::{fn_def_id, is_from_proc_macro, path_to_local_id, span_find_starting_semi};
use core::ops::ControlFlow;
use if_chain::if_chain;
use rustc_errors::Applicability;
@ -113,8 +113,8 @@
/// Ok(())
/// }
/// ```
#[clippy::version = "1.72.0"]
pub NEEDLESS_RETURN_WITH_TRY,
#[clippy::version = "1.73.0"]
pub NEEDLESS_RETURN_WITH_QUESTION_MARK,
style,
"using a return statement like `return Err(expr)?;` where removing it would suffice"
}
@ -158,7 +158,7 @@ fn to_string(&self) -> String {
}
}
declare_lint_pass!(Return => [LET_AND_RETURN, NEEDLESS_RETURN, NEEDLESS_RETURN_WITH_TRY]);
declare_lint_pass!(Return => [LET_AND_RETURN, NEEDLESS_RETURN, NEEDLESS_RETURN_WITH_QUESTION_MARK]);
impl<'tcx> LateLintPass<'tcx> for Return {
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
@ -177,7 +177,7 @@ fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'_>) {
{
span_lint_and_sugg(
cx,
NEEDLESS_RETURN_WITH_TRY,
NEEDLESS_RETURN_WITH_QUESTION_MARK,
expr.span.until(ret.span),
"unneeded `return` statement with `?` operator",
"remove it",

View File

@ -1,5 +1,5 @@
//@run-rustfix
//@aux-build:proc_macros.rs
//@aux-build:proc_macros.rs:proc-macro
#![allow(
clippy::needless_return,
clippy::no_effect,

View File

@ -1,5 +1,5 @@
//@run-rustfix
//@aux-build:proc_macros.rs
//@aux-build:proc_macros.rs:proc-macro
#![allow(
clippy::needless_return,
clippy::no_effect,

View File

@ -1,10 +1,10 @@
error: unneeded `return` statement with `?` operator
--> $DIR/needless_return_with_try.rs:28:5
--> $DIR/needless_return_with_question_mark.rs:28:5
|
LL | return Err(())?;
| ^^^^^^^ help: remove it
|
= note: `-D clippy::needless-return-with-try` implied by `-D warnings`
= note: `-D clippy::needless-return-with-question-mark` implied by `-D warnings`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@
#![allow(
clippy::unnecessary_wraps,
clippy::needless_question_mark,
clippy::needless_return_with_try
clippy::needless_return_with_question_mark
)]
extern crate proc_macros;

View File

@ -5,7 +5,7 @@
#![allow(
clippy::unnecessary_wraps,
clippy::needless_question_mark,
clippy::needless_return_with_try
clippy::needless_return_with_question_mark
)]
extern crate proc_macros;