difftreelog
refactor drop IntoUntyped for Thunk<T>
in: master
Unnecessarily reallocates... I wish we had specialization...
1 file changed
crates/jrsonnet-evaluator/src/typed/conversions.rsdiffbeforeafterboth127 const TYPE: &'static ComplexValType = &ComplexValType::Lazy(T::TYPE);127 const TYPE: &'static ComplexValType = &ComplexValType::Lazy(T::TYPE);128}128}129129130impl<T> IntoUntyped for Thunk<T>130impl IntoUntyped for Thunk<Val> {131where132 T: Typed + IntoUntyped + Trace + Clone,133{134 fn into_untyped(typed: Self) -> Result<Val> {131 fn into_untyped(typed: Self) -> Result<Val> {135 T::into_untyped(typed.evaluate()?)132 typed.evaluate()136 }133 }137 fn provides_lazy() -> bool {134 fn provides_lazy() -> bool {138 true135 true139 }136 }140137141 fn into_lazy_untyped(inner: Self) -> Thunk<Val> {138 fn into_lazy_untyped(inner: Self) -> Thunk<Val> {142 inner.map(<ThunkIntoUntyped<T>>::default())139 inner143 }140 }144}141}145142