aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/tests.rs')
-rw-r--r--crates/hir_ty/src/tests.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs
index 510baadf2..29b178ec1 100644
--- a/crates/hir_ty/src/tests.rs
+++ b/crates/hir_ty/src/tests.rs
@@ -157,14 +157,13 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
157 (node.value.text_range(), node.value.text().to_string().replace("\n", " ")) 157 (node.value.text_range(), node.value.text().to_string().replace("\n", " "))
158 }; 158 };
159 let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" }; 159 let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" };
160 let module = db.module_for_file(node.file_id.original_file(&db));
161 format_to!( 160 format_to!(
162 buf, 161 buf,
163 "{}{:?} '{}': {}\n", 162 "{}{:?} '{}': {}\n",
164 macro_prefix, 163 macro_prefix,
165 range, 164 range,
166 ellipsize(text, 15), 165 ellipsize(text, 15),
167 ty.display_test(&db, module).unwrap() 166 ty.display_test(&db)
168 ); 167 );
169 } 168 }
170 if include_mismatches { 169 if include_mismatches {
@@ -175,14 +174,13 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
175 for (src_ptr, mismatch) in &mismatches { 174 for (src_ptr, mismatch) in &mismatches {
176 let range = src_ptr.value.text_range(); 175 let range = src_ptr.value.text_range();
177 let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" }; 176 let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" };
178 let module = db.module_for_file(src_ptr.file_id.original_file(&db));
179 format_to!( 177 format_to!(
180 buf, 178 buf,
181 "{}{:?}: expected {}, got {}\n", 179 "{}{:?}: expected {}, got {}\n",
182 macro_prefix, 180 macro_prefix,
183 range, 181 range,
184 mismatch.expected.display_test(&db, module).unwrap(), 182 mismatch.expected.display_test(&db),
185 mismatch.actual.display_test(&db, module).unwrap(), 183 mismatch.actual.display_test(&db),
186 ); 184 );
187 } 185 }
188 } 186 }