cl-ast: Fix pretty-printing for use items
This commit is contained in:
parent
7c73fd335c
commit
db0b791b24
@ -284,11 +284,8 @@ mod display {
|
|||||||
impl Display for Use {
|
impl Display for Use {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let Self { absolute, tree } = self;
|
let Self { absolute, tree } = self;
|
||||||
if *absolute {
|
f.write_str(if *absolute { "use ::" } else { "use " })?;
|
||||||
write!(f, "use ::{tree}")
|
write!(f, "{tree};")
|
||||||
} else {
|
|
||||||
write!(f, "use {tree}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,15 +787,15 @@ mod path {
|
|||||||
}
|
}
|
||||||
/// Concatenates `self::other`. If `other` is an absolute [Path],
|
/// Concatenates `self::other`. If `other` is an absolute [Path],
|
||||||
/// this replaces `self` with `other`
|
/// this replaces `self` with `other`
|
||||||
pub fn concat(&mut self, other: &Self) -> &mut Self {
|
pub fn concat(mut self, other: &Self) -> Self {
|
||||||
if other.absolute {
|
if other.absolute {
|
||||||
*self = other.clone();
|
other.clone()
|
||||||
} else {
|
} else {
|
||||||
self.parts.extend(other.parts.iter().cloned())
|
self.parts.extend(other.parts.iter().cloned());
|
||||||
}
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
impl PathPart {
|
impl PathPart {
|
||||||
pub fn from_ident(ident: Identifier) -> Self {
|
pub fn from_ident(ident: Identifier) -> Self {
|
||||||
Self::Ident(ident)
|
Self::Ident(ident)
|
||||||
|
Loading…
Reference in New Issue
Block a user