chore: cargo clippy

This commit is contained in:
2025-05-28 22:47:35 +08:00
parent f3bf44ab97
commit c8276c1729
7 changed files with 13 additions and 14 deletions

View File

@@ -68,7 +68,7 @@ pub fn env<'gc>(vm: &VM, mc: &Mutation<'gc>) -> Gc<'gc, VmEnv<'gc>> {
let primop = Gc::new(mc, primop);
env_map.insert(
vm.new_sym(format!("__{}", primop.name)),
Value::PrimOp(primop.clone()),
Value::PrimOp(primop),
);
map.insert(vm.new_sym(primop.name), Value::PrimOp(primop));
}
@@ -83,5 +83,5 @@ pub fn env<'gc>(vm: &VM, mc: &Mutation<'gc>) -> Gc<'gc, VmEnv<'gc>> {
let builtins = Value::AttrSet(attrs);
env_map.insert(sym, builtins);
VmEnv::new(Gc::new(mc, env_map.into()), mc)
VmEnv::new(Gc::new(mc, env_map), mc)
}

View File

@@ -199,7 +199,7 @@ impl<'gc> JITContext<'gc> {
pub fn compile_seq(
&self,
opcodes: impl Iterator<Item = OpCode> + ExactSizeIterator + DoubleEndedIterator,
opcodes: impl ExactSizeIterator<Item = OpCode> + DoubleEndedIterator,
vm: &'gc VM<'gc>,
) -> Result<JITFunc<'gc>> {
let mut stack = Stack::<_, STACK_SIZE>::new();
@@ -330,8 +330,7 @@ impl<'gc> JITContext<'gc> {
"call_capture_env",
)?
.try_as_basic_value()
.unwrap_left()
.into(),
.unwrap_left(),
)?,
OpCode::ForceValue => {
let thunk = stack.pop();

View File

@@ -32,7 +32,7 @@ impl<'gc> Deref for AttrSet<'gc> {
}
}
impl<'jit: 'vm, 'vm, 'gc> AttrSet<'gc> {
impl<'gc> AttrSet<'gc> {
pub fn with_capacity(cap: usize) -> Self {
AttrSet {
data: HashMap::with_capacity(cap),

View File

@@ -102,7 +102,7 @@ impl<'gc> Func<'gc> {
.select(formal)
.or_else(|| {
default
.map(|idx| Value::Thunk(Thunk::new(vm.get_thunk(idx), mc).into()))
.map(|idx| Value::Thunk(Thunk::new(vm.get_thunk(idx), mc)))
})
.unwrap();
new.insert(formal, arg);
@@ -110,7 +110,7 @@ impl<'gc> Func<'gc> {
if let Some(alias) = alias {
new.insert(alias, Value::AttrSet(arg));
}
env.enter_let(Gc::new(mc, new.into()), mc)
env.enter_let(Gc::new(mc, new), mc)
}
};

View File

@@ -177,7 +177,7 @@ impl<'gc> Value<'gc> {
}
}
impl<'jit: 'vm, 'vm, 'gc> PartialEq for Value<'gc> {
impl<'gc> PartialEq for Value<'gc> {
fn eq(&self, other: &Self) -> bool {
use Value::*;
match (self, other) {

View File

@@ -51,7 +51,7 @@ pub struct PartialPrimOp<'gc> {
func: fn(Vec<Value<'gc>>, &VM, &Mutation<'gc>) -> Result<Value<'gc>>,
}
unsafe impl<'jit: 'vm, 'vm, 'gc> Collect<'gc> for PartialPrimOp<'gc> {
unsafe impl<'gc> Collect<'gc> for PartialPrimOp<'gc> {
fn trace<Tr: gc_arena::collect::Trace<'gc>>(&self, cc: &mut Tr) {
for v in self.args.iter() {
v.trace(cc);

View File

@@ -119,7 +119,7 @@ pub fn eval<T, F: for<'gc> FnOnce(Value<'gc>, &mut GcRoot<'gc>, &Mutation<'gc>)
.or_else(|| {
default.map(|idx| {
Value::Thunk(
Thunk::new(root.vm.get_thunk(idx), mc).into(),
Thunk::new(root.vm.get_thunk(idx), mc),
)
})
})
@@ -129,7 +129,7 @@ pub fn eval<T, F: for<'gc> FnOnce(Value<'gc>, &mut GcRoot<'gc>, &Mutation<'gc>)
if let Some(alias) = alias {
new.insert(alias, Value::AttrSet(arg));
}
env.enter_let(Gc::new(mc, new.into()), mc)
env.enter_let(Gc::new(mc, new), mc)
}
};
let count = func.count.get();
@@ -283,7 +283,7 @@ fn single_op<'gc, const CAP: usize>(
.iter()
.map(|(&k, v)| (k, v.clone()))
.collect_into(&mut new);
*env = env.enter_let(Gc::new(mc, new.into()), mc);
*env = env.enter_let(Gc::new(mc, new), mc);
stack
.tos_mut()
.as_mut(mc)
@@ -344,7 +344,7 @@ fn single_op<'gc, const CAP: usize>(
.iter()
.map(|(&k, v)| (k, v.clone()))
.collect_into(&mut new);
*env = env.enter_let(Gc::new(mc, new.into()), mc);
*env = env.enter_let(Gc::new(mc, new), mc);
}
OpCode::LeaveEnv => *env = env.leave(),
OpCode::EnterWithEnv => {