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 :)
This commit is contained in:
Florian Diebold
2019-03-14 22:03:39 +01:00
committed by Florian Diebold
parent eb4d6cf25f
commit c5ee60e05b
7 changed files with 136 additions and 60 deletions

View File

@@ -10,6 +10,7 @@ use test_utils::covers;
use crate::{
source_binder,
mock::MockDatabase,
ty::display::HirDisplay,
};
// 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 {
let node = algo::find_node_at_offset::<ast::Expr>(syntax.syntax(), pos.offset).unwrap();
let expr = body_source_map.node_expr(node).unwrap();
let ty = &inference_result[expr];
ty.to_string()
ty.display(db).to_string()
}
fn infer(content: &str) -> String {
@@ -2178,7 +2179,7 @@ fn infer(content: &str) -> String {
"{} '{}': {}\n",
syntax_ptr.range(),
ellipsize(node.text().to_string().replace("\n", " "), 15),
ty
ty.display(&db)
)
.unwrap();
}