refactor(tvix/eval): remove redundant clone

This CL removes redundant clone from value which is
going to be dropped without further use.

Change-Id: Ibd2a724853c5cfbf8ca40bf0b3adf0fab89b9be5
Signed-off-by: Aaqa Ishtyaq <aaqaishtyaq@gmail.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8125
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Aaqa Ishtyaq 2023-02-16 14:29:46 +05:30 committed by clbot
parent bfe6cace5e
commit faffb2a4cb
3 changed files with 6 additions and 6 deletions

View file

@ -9,7 +9,7 @@ use ast::Expr;
pub(super) fn optimise_expr(c: &mut Compiler, slot: LocalIdx, expr: ast::Expr) -> ast::Expr {
match expr {
Expr::BinOp(_) => optimise_bin_op(c, slot, expr),
_ => expr.to_owned(),
_ => expr,
}
}

View file

@ -303,7 +303,7 @@ fn parse_compile_internal(
let compiler_result = match compiler::compile(
result.expr.as_ref().unwrap(),
location,
file.clone(),
file,
builtins,
compiler_observer,
) {

View file

@ -189,7 +189,7 @@ impl Thunk {
// returning another thunk.
ThunkRepr::Native(native) => {
let value = native.0(vm)?;
self.0.replace(ThunkRepr::Evaluated(value.clone()));
self.0.replace(ThunkRepr::Evaluated(value));
let self_clone = self.clone();
return Ok(Trampoline {
@ -268,7 +268,7 @@ impl Thunk {
ThunkRepr::Native(native) => {
let value = native.0(vm)?;
self.0.replace(ThunkRepr::Evaluated(value.clone()));
inner.0.replace(ThunkRepr::Evaluated(value.clone()));
inner.0.replace(ThunkRepr::Evaluated(value));
let self_clone = self.clone();
return Ok(Trampoline {
@ -308,7 +308,7 @@ impl Thunk {
debug_assert!(matches!(self_blackhole, ThunkRepr::Blackhole));
let inner_blackhole =
inner_clone.0.replace(ThunkRepr::Evaluated(result.clone()));
inner_clone.0.replace(ThunkRepr::Evaluated(result));
debug_assert!(matches!(inner_blackhole, ThunkRepr::Blackhole));
Thunk::force_trampoline(vm, Value::Thunk(self_clone))
@ -330,7 +330,7 @@ impl Thunk {
// out of here and memoize the innermost thunk.
ThunkRepr::Evaluated(v) => {
self.0.replace(ThunkRepr::Evaluated(v.clone()));
inner.0.replace(ThunkRepr::Evaluated(v.clone()));
inner.0.replace(ThunkRepr::Evaluated(v));
let self_clone = self.clone();
return Ok(Trampoline {