Fix: Remove unnecessary Rc::new from LambdaCollector

The `LambdaCollector` was cloning nodes and wrapping them in `Rc`.
However, the `registry` itself is already holding `Rc` clones of the
nodes. This commit removes the redundant `Rc::new` to simplify the code.

This change also addresses a performance regression observed in
benchmarks due to unnecessary atomic overhead from `Arc` in the
`Keyword` type.
This commit is contained in:
Michael Schimmel
2026-03-06 14:18:51 +01:00
parent 1f5aefb216
commit dfc963ef13
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -33,7 +33,7 @@ impl<'a, T: Clone> LambdaCollector<'a, T> {
if let BoundKind::Lambda { .. } = &current.kind {
self.registry
.insert(*global_index, Rc::new((**current).clone()));
.insert(*global_index, (*current).clone());
}
}
self.visit(value);
@@ -49,7 +49,7 @@ impl<'a, T: Clone> LambdaCollector<'a, T> {
if let BoundKind::Lambda { .. } = &current.kind {
self.registry
.insert(*global_index, Rc::new((**current).clone()));
.insert(*global_index, (*current).clone());
}
}
self.visit(value);