aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-16 15:42:36 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-16 15:42:36 +0000
commit76572e67eabffa959c665f8450dbb12d71848aba (patch)
treec293e134706908ddc54400dee029271ec9859692 /crates/ra_hir/src/ty/tests.rs
parentb6ddf976f1b00703a35b91a5aa04debf19b7ca25 (diff)
parentc5ee60e05b1fafe20f56b21cfab30e7b80cb9d42 (diff)
Merge #976
976: Replace Display by a pretty printing trait for Ty r=matklad a=flodiebold This allows removing the names from Adt and FnDef (and more later), as a first step towards aligning more with chalk's Ty :) I may have gone a bit overboard with the definition of the PrettyPrint trait... Co-authored-by: Florian Diebold <[email protected]>
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 }