aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-05-07 11:08:42 +0100
committerFlorian Diebold <[email protected]>2019-05-07 12:45:29 +0100
commit4083caa233b03a390aca87e96e5bd290961df04c (patch)
tree55c1ddb3c5ddab9e2e9b16657ccc0771e7d0b9af /crates/ra_hir
parenta78228a39c4786e67e5a94384388a04aa8d7b172 (diff)
Add a HirDisplay implementation for TraitRef
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ty.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 24c45d728..12429a668 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -534,3 +534,20 @@ impl HirDisplay for Ty {
534 Ok(()) 534 Ok(())
535 } 535 }
536} 536}
537
538impl HirDisplay for TraitRef {
539 fn hir_fmt(&self, f: &mut HirFormatter<impl HirDatabase>) -> fmt::Result {
540 write!(
541 f,
542 "{}: {}",
543 self.substs[0].display(f.db),
544 self.trait_.name(f.db).unwrap_or_else(Name::missing)
545 )?;
546 if self.substs.len() > 1 {
547 write!(f, "<")?;
548 f.write_joined(&self.substs[1..], ", ")?;
549 write!(f, ">")?;
550 }
551 Ok(())
552 }
553}