From 50a147dcdfd0df462f0c24e5d7bcfe60abadac32 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sun, 4 Oct 2020 09:12:00 +0300 Subject: Apply case check diagnostic to impl items --- crates/hir/src/code_model.rs | 3 ++- crates/ide/src/diagnostics.rs | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index c134356ef..fb85041fd 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -781,7 +781,8 @@ impl Function { } pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { - hir_ty::diagnostics::validate_body(db, self.id.into(), sink) + hir_ty::diagnostics::validate_module_item(db, self.id.into(), sink); + hir_ty::diagnostics::validate_body(db, self.id.into(), sink); } /// Whether this function declaration has a definition. diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 70d5cbd38..8e508639b 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -903,6 +903,30 @@ fn some_fn() { fn foo() { const ANOTHER_ITEM<|>: &str = "some_item"; } +"#, + ); + } + + #[test] + fn test_rename_incorrect_case_struct_method() { + check_fixes( + r#" +pub struct TestStruct; + +impl TestStruct { + pub fn SomeFn<|>() -> TestStruct { + TestStruct + } +} +"#, + r#" +pub struct TestStruct; + +impl TestStruct { + pub fn some_fn() -> TestStruct { + TestStruct + } +} "#, ); } -- cgit v1.2.3