diff --git a/src/main.rs b/src/main.rs index a40fedc..0ac0aed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,7 +80,7 @@ fn main() -> anyhow::Result<()> { .parse(stream) .map_err(|e| anyhow!("{e:?}"))?; - println!("{}", pretty::pretty_to_string(program, 100)); + print!("{}", pretty::pretty_to_string(program, 100)); } Command::Desugar { diff --git a/src/pretty.rs b/src/pretty.rs index cb1d34f..0c91c87 100644 --- a/src/pretty.rs +++ b/src/pretty.rs @@ -21,5 +21,7 @@ pub fn pretty_to_string>(p: P, width: usize) -> p.pretty(&RcAllocator) .render(width, &mut out) .expect("p could not be rendered"); - String::from_utf8(out).expect("p created non-utf8 string") + let mut s = String::from_utf8(out).expect("p created non-utf8 string"); + s.push('\n'); + s }