chore: cargo fmt

This commit is contained in:
2025-06-17 11:59:53 +08:00
parent 7f6848c9e5
commit 3e9f0a72a0
7 changed files with 65 additions and 38 deletions

View File

@@ -180,8 +180,7 @@ impl Evaluate for ir::If {
impl Evaluate for ir::LoadFunc {
fn eval(self, engine: &mut Engine, env: &mut VmEnv) -> Result<Value> {
let idx = engine.func_offset + self.idx;
Value::Func(idx)
.ok()
Value::Func(idx).ok()
}
}
@@ -189,7 +188,14 @@ impl Evaluate for ir::Call {
fn eval(self, engine: &mut Engine, env: &mut VmEnv) -> Result<Value> {
let mut func = self.func.eval(engine, env)?;
func.force(engine, env)?;
func.call(self.args.into_iter().map(|arg| arg.eval(engine, env)).collect::<Result<_>>()?, engine, env)?;
func.call(
self.args
.into_iter()
.map(|arg| arg.eval(engine, env))
.collect::<Result<_>>()?,
engine,
env,
)?;
// FIXME: Modify Value::call
// for arg in self.args {
// func.call(arg.eval(engine, env)?, engine, env)?;
@@ -263,8 +269,9 @@ impl Evaluate for ir::Const {
impl Evaluate for ir::Var {
fn eval(self, _: &mut Engine, env: &mut VmEnv) -> Result<Value> {
env.lookup_with(&self.sym)
.ok_or_else(|| Error::EvalError(format!("variable {} not found", Symbol::from(self.sym))))
env.lookup_with(&self.sym).ok_or_else(|| {
Error::EvalError(format!("variable {} not found", Symbol::from(self.sym)))
})
}
}