aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-03-14 21:03:39 +0000
committerFlorian Diebold <[email protected]>2019-03-16 15:36:59 +0000
commitc5ee60e05b1fafe20f56b21cfab30e7b80cb9d42 (patch)
tree9a6e1f6aeb348ac5c6c5e0f89cd791a9430550f2 /crates/ra_hir/src/ty/tests.rs
parenteb4d6cf25f9ba886f4aa8ee46149af2807baae7f (diff)
Replace Display by a pretty printing trait for Ty
This allows removing the names from Adt and FnDef (and more later), as a first step towards aligning more with chalk's Ty :)
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index c7d409e6d..acae71c26 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -10,6 +10,7 @@ use test_utils::covers;
10use crate::{ 10use crate::{
11 source_binder, 11 source_binder,
12 mock::MockDatabase, 12 mock::MockDatabase,
13 ty::display::HirDisplay,
13}; 14};
14 15
15// These tests compare the inference results for all expressions in a file 16// These tests compare the inference results for all expressions in a file
@@ -2142,7 +2143,7 @@ fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String {
2142 let node = algo::find_node_at_offset::<ast::Expr>(syntax.syntax(), pos.offset).unwrap(); 2143 let node = algo::find_node_at_offset::<ast::Expr>(syntax.syntax(), pos.offset).unwrap();
2143 let expr = body_source_map.node_expr(node).unwrap(); 2144 let expr = body_source_map.node_expr(node).unwrap();
2144 let ty = &inference_result[expr]; 2145 let ty = &inference_result[expr];
2145 ty.to_string() 2146 ty.display(db).to_string()
2146} 2147}
2147 2148
2148fn infer(content: &str) -> String { 2149fn infer(content: &str) -> String {
@@ -2178,7 +2179,7 @@ fn infer(content: &str) -> String {
2178 "{} '{}': {}\n", 2179 "{} '{}': {}\n",
2179 syntax_ptr.range(), 2180 syntax_ptr.range(),
2180 ellipsize(node.text().to_string().replace("\n", " "), 15), 2181 ellipsize(node.text().to_string().replace("\n", " "), 15),
2181 ty 2182 ty.display(&db)
2182 ) 2183 )
2183 .unwrap(); 2184 .unwrap();
2184 } 2185 }