Skip to content

Commit

Permalink
remove trailing newlines from display
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjfvi committed Mar 19, 2024
1 parent af02991 commit 55573d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,11 @@ impl FromStr for Tree {

impl fmt::Display for Book {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for (name, net) in self.iter() {
writeln!(f, "@{name} = {net}\n")?;
for (i, (name, net)) in self.iter().enumerate() {
if i != 0 {
f.write_str("\n\n")?;
}
write!(f, "@{name} = {net}")?;
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn main() {
}
CliMode::Transform { transform_opts, files } => {
let book = load_book(&files, &transform_opts);
print!("{}", book);
println!("{}", book);
}
}
} else {
Expand Down
3 changes: 0 additions & 3 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ fn test_cli_transform() {
@mul = (<* a b> (a b))
@sub = (<- a b> (a b))
"###
);

Expand All @@ -161,7 +160,6 @@ fn test_cli_transform() {
@mul = (<* a b> (a b))
@sub = (<- a b> (a b))
"###
);

Expand All @@ -176,7 +174,6 @@ fn test_cli_transform() {
@r###"
@main = a
& @HVM.log ~ (#1 (#2 a))
"###
);
}
Expand Down

0 comments on commit 55573d2

Please sign in to comment.