diff --git a/ast/src/statements/conditional_statement.rs b/ast/src/statements/conditional_statement.rs index e11cab8a1c..6cfd97d97e 100644 --- a/ast/src/statements/conditional_statement.rs +++ b/ast/src/statements/conditional_statement.rs @@ -39,11 +39,11 @@ pub struct ConditionalStatement<'ast> { impl<'ast> fmt::Display for ConditionalStatement<'ast> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "if ({}) {{\n", self.condition)?; - write!(f, "\t{:#?}\n", self.statements)?; + writeln!(f, "if ({}) {{", self.condition)?; + writeln!(f, "\t{:#?}", self.statements)?; self.next .as_ref() .map(|n_or_e| write!(f, "}} {}", n_or_e)) - .unwrap_or(write!(f, "}}")) + .unwrap_or_else(|| write!(f, "}}")) } } diff --git a/typed/src/circuits/circuit.rs b/typed/src/circuits/circuit.rs index ef29f140d1..a93463a4cf 100644 --- a/typed/src/circuits/circuit.rs +++ b/typed/src/circuits/circuit.rs @@ -41,9 +41,9 @@ impl<'ast> From> for Circuit { impl Circuit { fn format(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "circuit {} {{ \n", self.circuit_name)?; + writeln!(f, "circuit {} {{ ", self.circuit_name)?; for field in self.members.iter() { - write!(f, " {}\n", field)?; + writeln!(f, " {}", field)?; } write!(f, "}}") } diff --git a/typed/src/statements/conditional_nested_or_end_statement.rs b/typed/src/statements/conditional_nested_or_end_statement.rs index 151ec816ac..cad2aeb84e 100644 --- a/typed/src/statements/conditional_nested_or_end_statement.rs +++ b/typed/src/statements/conditional_nested_or_end_statement.rs @@ -47,9 +47,9 @@ impl fmt::Display for ConditionalNestedOrEndStatement { match *self { ConditionalNestedOrEndStatement::Nested(ref nested) => write!(f, "else {}", nested), ConditionalNestedOrEndStatement::End(ref statements) => { - write!(f, "else {{\n")?; + writeln!(f, "else {{")?; for statement in statements.iter() { - write!(f, "\t\t{}\n", statement)?; + writeln!(f, "\t\t{}", statement)?; } write!(f, "\t}}") } diff --git a/typed/src/statements/conditional_statement.rs b/typed/src/statements/conditional_statement.rs index 019e22f5ed..0923736fb2 100644 --- a/typed/src/statements/conditional_statement.rs +++ b/typed/src/statements/conditional_statement.rs @@ -46,9 +46,9 @@ impl<'ast> From> for ConditionalStatement { impl fmt::Display for ConditionalStatement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "if ({}) {{\n", self.condition)?; + writeln!(f, "if ({}) {{", self.condition)?; for statement in self.statements.iter() { - write!(f, "\t\t{}\n", statement)?; + writeln!(f, "\t\t{}", statement)?; } match self.next.clone() { Some(n_or_e) => write!(f, "\t}} {}", n_or_e), diff --git a/typed/src/statements/statement.rs b/typed/src/statements/statement.rs index b56defbc27..d91880bea6 100644 --- a/typed/src/statements/statement.rs +++ b/typed/src/statements/statement.rs @@ -204,9 +204,9 @@ impl fmt::Display for Statement { Statement::Assign(ref variable, ref statement, ref _span) => write!(f, "{} = {};", variable, statement), Statement::Conditional(ref statement, ref _span) => write!(f, "{}", statement), Statement::Iteration(ref var, ref start, ref stop, ref list, ref _span) => { - write!(f, "for {} in {}..{} {{\n", var, start, stop)?; + writeln!(f, "for {} in {}..{} {{", var, start, stop)?; for l in list { - write!(f, "\t\t{}\n", l)?; + writeln!(f, "\t\t{}", l)?; } write!(f, "\t}}") }