mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 19:43:24 +00:00
Add a HirDisplay implementation for TraitRef
This commit is contained in:
parent
a78228a39c
commit
4083caa233
@ -534,3 +534,20 @@ impl HirDisplay for Ty {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl HirDisplay for TraitRef {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<impl HirDatabase>) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}: {}",
|
||||
self.substs[0].display(f.db),
|
||||
self.trait_.name(f.db).unwrap_or_else(Name::missing)
|
||||
)?;
|
||||
if self.substs.len() > 1 {
|
||||
write!(f, "<")?;
|
||||
f.write_joined(&self.substs[1..], ", ")?;
|
||||
write!(f, ">")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user