Skip to content

Commit 0d52689

Browse files
author
Ralph Küpper
committed
style: rustfmt the lowering-perf changes
1 parent 11731e5 commit 0d52689

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎crates/perry-hir/src/lower/context.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,9 @@ impl LoweringContext {
610610
) {
611611
// Forward-scan (first-match-wins): index keeps the FIRST entry per name.
612612
let idx = self.class_statics.len();
613-
self.class_statics_index.entry(class_name.clone()).or_insert(idx);
613+
self.class_statics_index
614+
.entry(class_name.clone())
615+
.or_insert(idx);
614616
self.class_statics
615617
.push((class_name, static_fields, static_methods));
616618
}
@@ -1032,7 +1034,9 @@ impl LoweringContext {
10321034
// Forward-scan (first-match-wins) semantics: only record the FIRST
10331035
// index for a name so lookups match the old `.iter().find()`.
10341036
let idx = self.native_modules.len();
1035-
self.native_modules_index.entry(local_name.clone()).or_insert(idx);
1037+
self.native_modules_index
1038+
.entry(local_name.clone())
1039+
.or_insert(idx);
10361040
self.native_modules
10371041
.push((local_name, module_name, method_name));
10381042
}

‎crates/perry-hir/src/lower/expr_function.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ fn lower_named_fn_expr(
534534
},
535535
Stmt::Return(Some(Expr::LocalGet(self_id))),
536536
];
537-
let (captures, mutable_captures) =
538-
compute_closure_captures(ctx, &body, &outer_local_ids, &[]);
537+
let (captures, mutable_captures) = compute_closure_captures(ctx, &body, &outer_local_ids, &[]);
539538
ctx.exit_scope(wrapper_scope);
540539

541540
Ok(Expr::Call {

‎crates/perry-hir/src/lower/tests.rs‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,16 @@ fn test_native_instance_index_shadowing_and_truncation() {
332332

333333
// Enter an inner scope: shadow `e` with a different native type.
334334
let mark = ctx.native_instances.len();
335-
ctx.register_native_instance("e".to_string(), "stream".to_string(), "Readable".to_string());
335+
ctx.register_native_instance(
336+
"e".to_string(),
337+
"stream".to_string(),
338+
"Readable".to_string(),
339+
);
336340
// Inner (last) binding wins.
337-
assert_eq!(ctx.lookup_native_instance("e"), Some(("stream", "Readable")));
341+
assert_eq!(
342+
ctx.lookup_native_instance("e"),
343+
Some(("stream", "Readable"))
344+
);
338345

339346
// Pop the inner scope: the outer binding must be restored.
340347
ctx.truncate_native_instances(mark);
@@ -404,10 +411,7 @@ fn perf_registry_lookup_is_flat_in_k() {
404411
acc += ctx.lookup_native_instance("missing").is_some() as u64;
405412
acc += ctx.lookup_native_module("missing").is_some() as u64;
406413
}
407-
eprintln!(
408-
"K={k:<6} {M} x3 lookups: {:?} (acc={acc})",
409-
t.elapsed()
410-
);
414+
eprintln!("K={k:<6} {M} x3 lookups: {:?} (acc={acc})", t.elapsed());
411415
}
412416
}
413417

0 commit comments

Comments
 (0)