mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Write seperator beforehand
This commit is contained in:
parent
6e288fdae0
commit
8e4c20da80
@ -205,11 +205,10 @@ impl fmt::Display for UseSegment {
|
||||
UseSegment::List(ref list) => {
|
||||
write!(f, "{{")?;
|
||||
for (i, item) in list.iter().enumerate() {
|
||||
let is_last = i == list.len() - 1;
|
||||
write!(f, "{}", item)?;
|
||||
if !is_last {
|
||||
if i != 0 {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "{}", item)?;
|
||||
}
|
||||
write!(f, "}}")
|
||||
}
|
||||
@ -219,11 +218,10 @@ impl fmt::Display for UseSegment {
|
||||
impl fmt::Display for UseTree {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
for (i, segment) in self.path.iter().enumerate() {
|
||||
let is_last = i == self.path.len() - 1;
|
||||
write!(f, "{}", segment)?;
|
||||
if !is_last {
|
||||
if i != 0 {
|
||||
write!(f, "::")?;
|
||||
}
|
||||
write!(f, "{}", segment)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user