Refine posistion display.

This commit is contained in:
Stephen Chung
2021-04-23 14:24:53 +08:00
parent 1fbbb2a40d
commit fc782c5563
5 changed files with 79 additions and 115 deletions

View File

@@ -1661,6 +1661,16 @@ impl fmt::Debug for NamespaceRef {
}
}
impl fmt::Display for NamespaceRef {
#[inline(always)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for Ident { name, .. } in self.path.iter() {
write!(f, "{}{}", name, Token::DoubleColon.syntax())?;
}
Ok(())
}
}
impl Deref for NamespaceRef {
type Target = StaticVec<Ident>;
@@ -1677,16 +1687,6 @@ impl DerefMut for NamespaceRef {
}
}
impl fmt::Display for NamespaceRef {
#[inline(always)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for Ident { name, .. } in self.path.iter() {
write!(f, "{}{}", name, Token::DoubleColon.syntax())?;
}
Ok(())
}
}
impl From<StaticVec<Ident>> for NamespaceRef {
#[inline(always)]
fn from(path: StaticVec<Ident>) -> Self {