From dec207f56a7b16075f68dcb89138d93a7eecdf43 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 13 Jun 2021 19:27:14 +0300 Subject: minor: simplify --- crates/ide/src/diagnostics/field_shorthand.rs | 10 +++++----- crates/ide/src/diagnostics/fixes/change_case.rs | 4 ++-- crates/ide/src/diagnostics/fixes/wrap_tail_expr.rs | 6 +++--- crates/ide/src/diagnostics/macro_error.rs | 6 ++---- crates/ide/src/diagnostics/missing_fields.rs | 6 +++--- 5 files changed, 15 insertions(+), 17 deletions(-) (limited to 'crates/ide/src/diagnostics') diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs index 01bd2dba6..e885a398e 100644 --- a/crates/ide/src/diagnostics/field_shorthand.rs +++ b/crates/ide/src/diagnostics/field_shorthand.rs @@ -98,17 +98,17 @@ fn check_pat_field_shorthand( #[cfg(test)] mod tests { - use crate::diagnostics::tests::{check_fix, check_no_diagnostics}; + use crate::diagnostics::tests::{check_diagnostics, check_fix}; #[test] fn test_check_expr_field_shorthand() { - check_no_diagnostics( + check_diagnostics( r#" struct A { a: &'static str } fn main() { A { a: "hello" } } "#, ); - check_no_diagnostics( + check_diagnostics( r#" struct A(usize); fn main() { A { 0: 0 } } @@ -154,13 +154,13 @@ fn main() { #[test] fn test_check_pat_field_shorthand() { - check_no_diagnostics( + check_diagnostics( r#" struct A { a: &'static str } fn f(a: A) { let A { a: hello } = a; } "#, ); - check_no_diagnostics( + check_diagnostics( r#" struct A(usize); fn f(a: A) { let A { 0: 0 } = a; } diff --git a/crates/ide/src/diagnostics/fixes/change_case.rs b/crates/ide/src/diagnostics/fixes/change_case.rs index 42be3375f..db1a37cd6 100644 --- a/crates/ide/src/diagnostics/fixes/change_case.rs +++ b/crates/ide/src/diagnostics/fixes/change_case.rs @@ -35,7 +35,7 @@ impl DiagnosticWithFixes for IncorrectCase { #[cfg(test)] mod change_case { use crate::{ - diagnostics::tests::{check_fix, check_no_diagnostics}, + diagnostics::tests::{check_diagnostics, check_fix}, fixture, AssistResolveStrategy, DiagnosticsConfig, }; @@ -102,7 +102,7 @@ fn some_fn() { #[test] fn test_uppercase_const_no_diagnostics() { - check_no_diagnostics( + check_diagnostics( r#" fn foo() { const ANOTHER_ITEM$0: &str = "some_item"; diff --git a/crates/ide/src/diagnostics/fixes/wrap_tail_expr.rs b/crates/ide/src/diagnostics/fixes/wrap_tail_expr.rs index 715a403b9..dcb21e037 100644 --- a/crates/ide/src/diagnostics/fixes/wrap_tail_expr.rs +++ b/crates/ide/src/diagnostics/fixes/wrap_tail_expr.rs @@ -25,7 +25,7 @@ impl DiagnosticWithFixes for MissingOkOrSomeInTailExpr { #[cfg(test)] mod tests { - use crate::diagnostics::tests::{check_fix, check_no_diagnostics}; + use crate::diagnostics::tests::{check_diagnostics, check_fix}; #[test] fn test_wrap_return_type_option() { @@ -169,7 +169,7 @@ fn div(x: i32, y: i32) -> MyResult { #[test] fn test_wrap_return_type_not_applicable_when_expr_type_does_not_match_ok_type() { - check_no_diagnostics( + check_diagnostics( r#" //- /main.rs crate:main deps:core use core::result::Result::{self, Ok, Err}; @@ -189,7 +189,7 @@ pub mod option { #[test] fn test_wrap_return_type_not_applicable_when_return_type_is_not_result_or_option() { - check_no_diagnostics( + check_diagnostics( r#" //- /main.rs crate:main deps:core use core::result::Result::{self, Ok, Err}; diff --git a/crates/ide/src/diagnostics/macro_error.rs b/crates/ide/src/diagnostics/macro_error.rs index d76a3a094..5f97f190d 100644 --- a/crates/ide/src/diagnostics/macro_error.rs +++ b/crates/ide/src/diagnostics/macro_error.rs @@ -15,9 +15,7 @@ pub(super) fn macro_error(ctx: &DiagnosticsContext<'_>, d: &hir::MacroError) -> #[cfg(test)] mod tests { use crate::{ - diagnostics::tests::{ - check_diagnostics, check_diagnostics_with_config, check_no_diagnostics, - }, + diagnostics::tests::{check_diagnostics, check_diagnostics_with_config}, DiagnosticsConfig, }; @@ -77,7 +75,7 @@ macro_rules! concat { () => {} } fn register_attr_and_tool() { cov_mark::check!(register_attr); cov_mark::check!(register_tool); - check_no_diagnostics( + check_diagnostics( r#" #![register_tool(tool)] #![register_attr(attr)] diff --git a/crates/ide/src/diagnostics/missing_fields.rs b/crates/ide/src/diagnostics/missing_fields.rs index 66575f713..95cd64956 100644 --- a/crates/ide/src/diagnostics/missing_fields.rs +++ b/crates/ide/src/diagnostics/missing_fields.rs @@ -77,7 +77,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::MissingFields) -> Option