aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/display.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-10-27 19:23:09 +0000
committerBenjamin Coenen <[email protected]>2020-10-27 19:23:09 +0000
commit73161cc9cdcdf7b9f797d7984f2cad497a3f4553 (patch)
tree52064fcade70bad4c25974bef717c5574354fa4c /crates/hir_ty/src/display.rs
parenta03f00476683f0e6e373c71e8ac788795029acb3 (diff)
do not use associated types placeholder for inlay hint #6191
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/display.rs')
-rw-r--r--crates/hir_ty/src/display.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index d2e151f25..43db24882 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -390,11 +390,27 @@ impl HirDisplay for ApplicationTy {
390 }; 390 };
391 let trait_ = f.db.trait_data(trait_); 391 let trait_ = f.db.trait_data(trait_);
392 let type_alias = f.db.type_alias_data(type_alias); 392 let type_alias = f.db.type_alias_data(type_alias);
393 write!(f, "{}::{}", trait_.name, type_alias.name)?; 393
394 if self.parameters.len() > 0 { 394 // Use placeholder associated types when the target is source code (https://rust-lang.github.io/chalk/book/clauses/type_equality.html#placeholder-associated-types)
395 write!(f, "<")?; 395 if f.display_target.is_source_code() || self.parameters.len() > 1 {
396 f.write_joined(&*self.parameters.0, ", ")?; 396 write!(f, "{}::{}", trait_.name, type_alias.name)?;
397 write!(f, ">")?; 397 if self.parameters.len() > 0 {
398 write!(f, "<")?;
399 f.write_joined(&*self.parameters.0, ", ")?;
400 write!(f, ">")?;
401 }
402 } else {
403 if self.parameters.len() == 1 {
404 write!(
405 f,
406 "<{} as {}>::{}",
407 self.parameters.as_single().display(f.db),
408 trait_.name,
409 type_alias.name
410 )?;
411 } else {
412 write!(f, "{}::{}", trait_.name, type_alias.name)?;
413 }
398 } 414 }
399 } 415 }
400 TypeCtor::ForeignType(type_alias) => { 416 TypeCtor::ForeignType(type_alias) => {