Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs b/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs
index 9c63d79d91..8310af0f52 100644
--- a/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs
+++ b/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs
@@ -97,13 +97,9 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &RemoveUnnecessaryElse) -> Option<Vec<
mod tests {
use crate::tests::{check_diagnostics, check_diagnostics_with_disabled, check_fix};
- fn check_diagnostics_with_needless_return_disabled(ra_fixture: &str) {
- check_diagnostics_with_disabled(ra_fixture, std::iter::once("needless_return".to_owned()));
- }
-
#[test]
fn remove_unnecessary_else_for_return() {
- check_diagnostics_with_needless_return_disabled(
+ check_diagnostics_with_disabled(
r#"
fn test() {
if foo {
@@ -114,6 +110,7 @@ fn test() {
}
}
"#,
+ &["needless_return"],
);
check_fix(
r#"
@@ -138,7 +135,7 @@ fn test() {
#[test]
fn remove_unnecessary_else_for_return2() {
- check_diagnostics_with_needless_return_disabled(
+ check_diagnostics_with_disabled(
r#"
fn test() {
if foo {
@@ -151,6 +148,7 @@ fn test() {
}
}
"#,
+ &["needless_return"],
);
check_fix(
r#"
@@ -216,7 +214,7 @@ fn test(a: bool) -> i32 {
#[test]
fn remove_unnecessary_else_for_return_in_child_if_expr() {
- check_diagnostics_with_needless_return_disabled(
+ check_diagnostics_with_disabled(
r#"
fn test() {
if foo {
@@ -229,6 +227,7 @@ fn test() {
}
}
"#,
+ &["needless_return"],
);
check_fix(
r#"
@@ -453,7 +452,7 @@ fn test() {
#[test]
fn no_diagnostic_if_no_divergence_in_else_branch() {
- check_diagnostics_with_needless_return_disabled(
+ check_diagnostics_with_disabled(
r#"
fn test() {
if foo {
@@ -463,6 +462,7 @@ fn test() {
}
}
"#,
+ &["needless_return"],
);
}