Skip to content

Commit 50a147d

Browse files
committed
Apply case check diagnostic to impl items
1 parent 2a72f87 commit 50a147d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

crates/hir/src/code_model.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ impl Function {
781781
}
782782

783783
pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) {
784-
hir_ty::diagnostics::validate_body(db, self.id.into(), sink)
784+
hir_ty::diagnostics::validate_module_item(db, self.id.into(), sink);
785+
hir_ty::diagnostics::validate_body(db, self.id.into(), sink);
785786
}
786787

787788
/// Whether this function declaration has a definition.

crates/ide/src/diagnostics.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,30 @@ fn some_fn() {
903903
fn foo() {
904904
const ANOTHER_ITEM<|>: &str = "some_item";
905905
}
906+
"#,
907+
);
908+
}
909+
910+
#[test]
911+
fn test_rename_incorrect_case_struct_method() {
912+
check_fixes(
913+
r#"
914+
pub struct TestStruct;
915+
916+
impl TestStruct {
917+
pub fn SomeFn<|>() -> TestStruct {
918+
TestStruct
919+
}
920+
}
921+
"#,
922+
r#"
923+
pub struct TestStruct;
924+
925+
impl TestStruct {
926+
pub fn some_fn() -> TestStruct {
927+
TestStruct
928+
}
929+
}
906930
"#,
907931
);
908932
}

0 commit comments

Comments
 (0)