Skip to content

Commit 93e5d26

Browse files
committed
fmt
1 parent 83406b8 commit 93e5d26

File tree

3 files changed

+10
-37
lines changed

3 files changed

+10
-37
lines changed

crates/compiler/src/a_simplify_lang.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,7 @@ fn handle_const_arguments_helper(
11321132
for (arg_expr, (arg_var, is_constant)) in args.iter().zip(&func.arguments) {
11331133
if *is_constant {
11341134
let const_eval = arg_expr.naive_eval().unwrap_or_else(|| {
1135-
panic!(
1136-
"Failed to evaluate constant argument: {arg_expr}"
1137-
)
1135+
panic!("Failed to evaluate constant argument: {arg_expr}")
11381136
});
11391137
const_evals.push((arg_var.clone(), const_eval));
11401138
}
@@ -1331,9 +1329,7 @@ impl ToString for VarOrConstMallocAccess {
13311329
malloc_label,
13321330
offset,
13331331
} => {
1334-
format!(
1335-
"ConstMallocAccess({malloc_label}, {offset})"
1336-
)
1332+
format!("ConstMallocAccess({malloc_label}, {offset})")
13371333
}
13381334
}
13391335
}
@@ -1349,13 +1345,7 @@ impl SimpleLine {
13491345
arg0,
13501346
arg1,
13511347
} => {
1352-
format!(
1353-
"{} = {} {} {}",
1354-
var.to_string(),
1355-
arg0,
1356-
operation,
1357-
arg1
1358-
)
1348+
format!("{} = {} {} {}", var.to_string(), arg0, operation, arg1)
13591349
}
13601350
Self::DecomposeBits {
13611351
var: result,
@@ -1365,9 +1355,7 @@ impl SimpleLine {
13651355
format!("{result} = decompose_bits({to_decompose})")
13661356
}
13671357
Self::RawAccess { res, index, shift } => {
1368-
format!(
1369-
"{res} = memory[{index} + {shift}]"
1370-
)
1358+
format!("{res} = memory[{index} + {shift}]")
13711359
}
13721360
Self::IfNotZero {
13731361
condition,
@@ -1387,9 +1375,7 @@ impl SimpleLine {
13871375
.join("\n");
13881376

13891377
if else_branch.is_empty() {
1390-
format!(
1391-
"if {condition} != 0 {{\n{then_str}\n{spaces}}}"
1392-
)
1378+
format!("if {condition} != 0 {{\n{then_str}\n{spaces}}}")
13931379
} else {
13941380
format!(
13951381
"if {condition} != 0 {{\n{then_str}\n{spaces}}} else {{\n{else_str}\n{spaces}}}"

crates/compiler/src/intermediate_bytecode.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,7 @@ impl ToString for IntermediateInstruction {
226226
shift_0,
227227
shift_1,
228228
res,
229-
} => format!(
230-
"{} = m[m[fp + {}] + {}]",
231-
res.to_string(),
232-
shift_0,
233-
shift_1
234-
),
229+
} => format!("{} = m[m[fp + {}] + {}]", res.to_string(), shift_0, shift_1),
235230
Self::DotProduct {
236231
arg0,
237232
arg1,

crates/compiler/src/lang/line.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ impl Line {
7474
index,
7575
value,
7676
} => {
77-
format!(
78-
"{array}[{index}] = {value}"
79-
)
77+
format!("{array}[{index}] = {value}")
8078
}
8179
Self::Assert(condition) => format!("assert {condition}"),
8280
Self::IfCondition {
@@ -97,9 +95,7 @@ impl Line {
9795
.join("\n");
9896

9997
if else_branch.is_empty() {
100-
format!(
101-
"if {condition} {{\n{then_str}\n{spaces}}}"
102-
)
98+
format!("if {condition} {{\n{then_str}\n{spaces}}}")
10399
} else {
104100
format!(
105101
"if {condition} {{\n{then_str}\n{spaces}}} else {{\n{else_str}\n{spaces}}}"
@@ -196,17 +192,13 @@ impl Line {
196192
vectorized,
197193
} => {
198194
if *vectorized {
199-
format!(
200-
"{var} = malloc_vectorized({size})"
201-
)
195+
format!("{var} = malloc_vectorized({size})")
202196
} else {
203197
format!("{var} = malloc({size})")
204198
}
205199
}
206200
Self::DecomposeBits { var, to_decompose } => {
207-
format!(
208-
"{var} = decompose_bits({to_decompose})"
209-
)
201+
format!("{var} = decompose_bits({to_decompose})")
210202
}
211203
Self::Break => "break".to_string(),
212204
Self::Panic => "panic".to_string(),

0 commit comments

Comments
 (0)