mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Clippy
This commit is contained in:
parent
a492d9d164
commit
1e448f84c3
2 changed files with 7 additions and 4 deletions
|
@ -179,7 +179,7 @@ fn test() {
|
|||
|
||||
#[test]
|
||||
fn remove_unnecessary_else_for_return3() {
|
||||
check_diagnostics_with_needless_return_disabled(
|
||||
check_diagnostics_with_disabled(
|
||||
r#"
|
||||
fn test(a: bool) -> i32 {
|
||||
if a {
|
||||
|
@ -190,6 +190,7 @@ fn test(a: bool) -> i32 {
|
|||
}
|
||||
}
|
||||
"#,
|
||||
&["needless_return", "E0425"],
|
||||
);
|
||||
check_fix(
|
||||
r#"
|
||||
|
@ -473,7 +474,7 @@ fn test() {
|
|||
|
||||
#[test]
|
||||
fn no_diagnostic_if_not_expr_stmt() {
|
||||
check_diagnostics_with_needless_return_disabled(
|
||||
check_diagnostics_with_disabled(
|
||||
r#"
|
||||
fn test1() {
|
||||
let _x = if a {
|
||||
|
@ -495,13 +496,15 @@ fn test2() {
|
|||
};
|
||||
}
|
||||
"#,
|
||||
&["needless_return", "E0425"],
|
||||
);
|
||||
check_diagnostics(
|
||||
check_diagnostics_with_disabled(
|
||||
r#"
|
||||
fn test3() -> u8 {
|
||||
foo(if a { return 1 } else { 0 })
|
||||
}
|
||||
"#,
|
||||
&["E0425"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue