Skip to content

Commit

Permalink
Use writeln!() to make clippy happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
01mf02 committed Mar 20, 2024
1 parent f693675 commit adaa0b0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jaq-play/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ impl<'a> Display for Pp<'a> {
Val::Str(s) => span_dbg(f, "string", escape(s)),
Val::Arr(a) if a.is_empty() => write!(f, "[]"),
Val::Arr(a) => {
write!(f, "[\n")?;
write!(f, "[")?;
writeln!(f)?;
let mut iter = a.iter().peekable();
while let Some(val) = iter.next() {
Pp {
Expand All @@ -66,14 +67,15 @@ impl<'a> Display for Pp<'a> {
if iter.peek().is_some() {
write!(f, ",")?;
}
write!(f, "\n")?;
writeln!(f)?;
}
indent(f, self.level)?;
write!(f, "]")
}
Val::Obj(o) if o.is_empty() => write!(f, "{{}}"),
Val::Obj(o) => {
write!(f, "{{\n")?;
write!(f, "{{")?;
writeln!(f)?;
let mut iter = o.iter().peekable();
while let Some((k, val)) = iter.next() {
indent(f, self.level + 1)?;
Expand All @@ -88,7 +90,7 @@ impl<'a> Display for Pp<'a> {
if iter.peek().is_some() {
write!(f, ",")?;
}
write!(f, "\n")?;
writeln!(f)?;
}
indent(f, self.level)?;
write!(f, "}}")
Expand Down

0 comments on commit adaa0b0

Please sign in to comment.