mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-20 08:01:42 +03:00
clippy: fix write_with_newline
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
4f46dd2982
commit
b8e22e0c96
@ -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, "}}"))
|
||||
}
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ impl<'ast> From<AstCircuit<'ast>> 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, "}}")
|
||||
}
|
||||
|
@ -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}}")
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ impl<'ast> From<AstConditionalStatement<'ast>> 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),
|
||||
|
@ -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}}")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user