aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r--crates/ra_hir_ty/src/tests.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 1fe05c70c..85ff26a36 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -67,8 +67,8 @@ fn type_at_pos_displayed(
67 panic!("Can't find expression") 67 panic!("Can't find expression")
68} 68}
69 69
70fn type_at(content: &str) -> String { 70fn type_at(ra_fixture: &str) -> String {
71 let (db, file_pos) = TestDB::with_position(content); 71 let (db, file_pos) = TestDB::with_position(ra_fixture);
72 type_at_pos(&db, file_pos) 72 type_at_pos(&db, file_pos)
73} 73}
74 74
@@ -164,13 +164,19 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
164 visit_module(&db, &crate_def_map, module.local_id, &mut |it| defs.push(it)); 164 visit_module(&db, &crate_def_map, module.local_id, &mut |it| defs.push(it));
165 defs.sort_by_key(|def| match def { 165 defs.sort_by_key(|def| match def {
166 DefWithBodyId::FunctionId(it) => { 166 DefWithBodyId::FunctionId(it) => {
167 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 167 let loc = it.lookup(&db);
168 let tree = db.item_tree(loc.id.file_id);
169 tree.source(&db, loc.id).syntax().text_range().start()
168 } 170 }
169 DefWithBodyId::ConstId(it) => { 171 DefWithBodyId::ConstId(it) => {
170 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 172 let loc = it.lookup(&db);
173 let tree = db.item_tree(loc.id.file_id);
174 tree.source(&db, loc.id).syntax().text_range().start()
171 } 175 }
172 DefWithBodyId::StaticId(it) => { 176 DefWithBodyId::StaticId(it) => {
173 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 177 let loc = it.lookup(&db);
178 let tree = db.item_tree(loc.id.file_id);
179 tree.source(&db, loc.id).syntax().text_range().start()
174 } 180 }
175 }); 181 });
176 for def in defs { 182 for def in defs {