From 1e448f84c3a05350af700de7903083572bba34fc Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 19 Feb 2024 13:53:29 +0100 Subject: [PATCH] Clippy --- .../src/handlers/remove_unnecessary_else.rs | 9 ++++++--- crates/ide-diagnostics/src/tests.rs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs b/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs index d5095b754696a..47844876dc540 100644 --- a/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs +++ b/crates/ide-diagnostics/src/handlers/remove_unnecessary_else.rs @@ -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"], ); } } diff --git a/crates/ide-diagnostics/src/tests.rs b/crates/ide-diagnostics/src/tests.rs index 9e134620ee3f1..901ceffbb266d 100644 --- a/crates/ide-diagnostics/src/tests.rs +++ b/crates/ide-diagnostics/src/tests.rs @@ -200,7 +200,7 @@ pub(crate) fn check_diagnostics(ra_fixture: &str) { #[track_caller] pub(crate) fn check_diagnostics_with_disabled(ra_fixture: &str, disabled: &[&str]) { let mut config = DiagnosticsConfig::test_sample(); - config.disabled.extend(disabled.into_iter().map(|&s| s.to_owned())); + config.disabled.extend(disabled.iter().map(|&s| s.to_owned())); check_diagnostics_with_config(config, ra_fixture) }