treewide: enforce strict clippy check
This commit is contained in:
+21
-13
@@ -1,5 +1,7 @@
|
||||
#![warn(clippy::unwrap_used)]
|
||||
#![cfg_attr(feature = "tailcall", expect(incomplete_features))]
|
||||
#![cfg_attr(
|
||||
feature = "tailcall",
|
||||
expect(incomplete_features, reason = "for testing purpose only")
|
||||
)]
|
||||
#![cfg_attr(
|
||||
feature = "tailcall",
|
||||
feature(explicit_tail_calls, rust_preserve_none_cc)
|
||||
@@ -9,7 +11,7 @@ use std::path::PathBuf;
|
||||
|
||||
use fix_bytecode::{Continuation, InstructionPtr};
|
||||
use fix_error::{Error, Result, Source};
|
||||
use fix_lang::{BUILTINS, BuiltinId, StringId};
|
||||
use fix_lang::{BuiltinId, StringId};
|
||||
use gc_arena::metrics::Pacing;
|
||||
use gc_arena::{Arena, Collect, Gc, Mutation, RefLock, Rootable};
|
||||
use hashbrown::HashMap;
|
||||
@@ -29,7 +31,10 @@ pub struct Vm<'gc> {
|
||||
stack: Vec<Value<'gc>>,
|
||||
call_stack: Vec<CallFrame<'gc>>,
|
||||
call_depth: usize,
|
||||
#[allow(dead_code)]
|
||||
#[expect(
|
||||
dead_code,
|
||||
reason = "error_context is reserved for tryEval catch-frame tracking, not yet wired up"
|
||||
)]
|
||||
#[collect(require_static)]
|
||||
error_context: Vec<ErrorFrame>,
|
||||
|
||||
@@ -38,7 +43,7 @@ pub struct Vm<'gc> {
|
||||
import_cache: HashMap<PathBuf, Value<'gc>>,
|
||||
scope_slots: Vec<Value<'gc>>,
|
||||
|
||||
builtins: Value<'gc>,
|
||||
builtins: Gc<'gc, AttrSet<'gc>>,
|
||||
empty_list: Value<'gc>,
|
||||
empty_attrs: Value<'gc>,
|
||||
|
||||
@@ -53,13 +58,12 @@ pub struct Vm<'gc> {
|
||||
functor_sym: StringId,
|
||||
}
|
||||
|
||||
fn init_builtins<'gc>(mc: &Mutation<'gc>, ctx: &mut impl VmRuntimeCtx) -> Value<'gc> {
|
||||
let mut entries = SmallVec::with_capacity(BUILTINS.len());
|
||||
fn init_builtins<'gc>(mc: &Mutation<'gc>, ctx: &mut impl VmRuntimeCtx) -> Gc<'gc, AttrSet<'gc>> {
|
||||
let mut entries = SmallVec::with_capacity(BuiltinId::TOTAL);
|
||||
|
||||
for (idx, &(name, arity)) in BUILTINS.iter().enumerate() {
|
||||
let id = BuiltinId::try_from(idx as u8).expect("infallible");
|
||||
let name = name.strip_prefix("__").unwrap_or(name);
|
||||
let name = ctx.intern_string(name);
|
||||
for id in BuiltinId::ALL {
|
||||
let arity = id.info().arity;
|
||||
let name = ctx.intern_string(id.info().name);
|
||||
let dispatch_ip = Continuation::entry_for_builtin(id).ip();
|
||||
entries.push((
|
||||
name,
|
||||
@@ -101,7 +105,7 @@ fn init_builtins<'gc>(mc: &Mutation<'gc>, ctx: &mut impl VmRuntimeCtx) -> Value<
|
||||
let builtins_value = Value::new(builtins_set);
|
||||
*self_ref_thunk.borrow_mut(mc) =
|
||||
ThunkState::Evaluated(builtins_value.restrict().expect("builtins is not a thunk"));
|
||||
builtins_value
|
||||
builtins_set
|
||||
}
|
||||
|
||||
impl<'gc> Vm<'gc> {
|
||||
@@ -298,7 +302,7 @@ impl<'gc> Machine<'gc> for Vm<'gc> {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn builtins(&self) -> Value<'gc> {
|
||||
fn builtins(&self) -> Gc<'gc, AttrSet<'gc>> {
|
||||
self.builtins
|
||||
}
|
||||
|
||||
@@ -456,6 +460,10 @@ impl<'gc> Vm<'gc> {
|
||||
|
||||
#[inline(always)]
|
||||
#[cfg(not(feature = "tailcall"))]
|
||||
#[expect(
|
||||
clippy::unreachable,
|
||||
reason = "Op::Illegal is a sentinel never emitted by codegen; reaching it is a codegen bug"
|
||||
)]
|
||||
fn execute_batch(
|
||||
&mut self,
|
||||
bytecode: &[u8],
|
||||
|
||||
Reference in New Issue
Block a user