Skip to content

Commit 085344c

Browse files
committed
Fixed displaying of namespace qualified symbols
1 parent 75e9889 commit 085344c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/symbol.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,18 @@ impl Symbol {
4242
pub fn unqualified(&self) -> Symbol {
4343
Symbol::intern(&self.name)
4444
}
45+
pub fn has_ns(&self) -> bool {
46+
self.ns != ""
47+
}
4548
}
4649
impl fmt::Display for Symbol {
4750
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48-
write!(f, "{}", self.name)
51+
if self.has_ns() {
52+
write!(f, "{}/{}", self.ns, self.name)
53+
}
54+
else {
55+
write!(f, "{}", self.name)
56+
}
4957
}
5058
}
5159
mod tests {

0 commit comments

Comments
 (0)