Refine namespace display.

This commit is contained in:
Stephen Chung
2021-10-27 23:30:25 +08:00
parent 00659d65d9
commit a5ae002cb7
6 changed files with 62 additions and 33 deletions

View File

@@ -1677,17 +1677,21 @@ impl fmt::Debug for NamespaceRef {
.iter()
.map(|Ident { name, .. }| name.as_str())
.collect::<StaticVec<_>>()
.join("::"),
.join(Token::DoubleColon.literal_syntax()),
)
}
}
impl fmt::Display for NamespaceRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for Ident { name, .. } in self.path.iter() {
write!(f, "{}{}", name, Token::DoubleColon.syntax())?;
}
Ok(())
f.write_str(
&self
.path
.iter()
.map(|Ident { name, .. }| name.as_str())
.collect::<StaticVec<_>>()
.join(Token::DoubleColon.literal_syntax()),
)
}
}