treewide: enforce strict clippy check
This commit is contained in:
@@ -117,6 +117,10 @@ pub(crate) fn op_select_dynamic<'gc, M: Machine<'gc>>(
|
||||
/// Only recognises Select opcodes and jumps; encountering any other
|
||||
/// opcode means we've reached the end of the select sequence and
|
||||
/// should report the missing-attribute error.
|
||||
#[expect(
|
||||
clippy::cast_sign_loss,
|
||||
reason = "jump target = pc + offset is a non-negative bytecode address by codegen invariant"
|
||||
)]
|
||||
fn select_skip<'gc, M: Machine<'gc>>(
|
||||
m: &mut M,
|
||||
key: StringId,
|
||||
@@ -126,6 +130,7 @@ fn select_skip<'gc, M: Machine<'gc>>(
|
||||
use fix_bytecode::Op::*;
|
||||
loop {
|
||||
match reader.read_op() {
|
||||
// Skip rest of the attrpath
|
||||
SelectStatic => {
|
||||
reader.set_pc(reader.pc() + 4 + 4);
|
||||
}
|
||||
@@ -136,10 +141,14 @@ fn select_skip<'gc, M: Machine<'gc>>(
|
||||
reader.set_pc(reader.pc() + 4);
|
||||
break Step::Continue(());
|
||||
}
|
||||
|
||||
// Default (`a.b or c`)
|
||||
JumpIfSelectFailed => {
|
||||
let offset = reader.read_i32();
|
||||
reader.set_pc(((reader.pc() as isize) + (offset as isize)) as usize);
|
||||
}
|
||||
|
||||
// Report error
|
||||
_ => {
|
||||
let name = ctx.resolve_string(key);
|
||||
return m.finish_err(Error::eval_error(format!("attribute '{name}' missing")));
|
||||
@@ -150,6 +159,14 @@ fn select_skip<'gc, M: Machine<'gc>>(
|
||||
|
||||
/// Skip the rest of a **HasAttr** attrpath after an intermediate
|
||||
/// lookup failed. Only recognises HasAttr opcodes and jumps.
|
||||
#[expect(
|
||||
clippy::cast_sign_loss,
|
||||
reason = "jump target = pc + offset is a non-negative bytecode address by codegen invariant"
|
||||
)]
|
||||
#[expect(
|
||||
clippy::unreachable,
|
||||
reason = "has_attr_skip only runs over a codegen-produced HasAttr attrpath sequence; any other opcode is a codegen bug"
|
||||
)]
|
||||
fn has_attr_skip(reader: &mut BytecodeReader<'_>) -> Step {
|
||||
use fix_bytecode::Op::*;
|
||||
loop {
|
||||
@@ -245,6 +262,10 @@ pub(crate) fn op_jump_if_select_failed<'gc, M: Machine<'gc>>(
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[expect(
|
||||
clippy::cast_sign_loss,
|
||||
reason = "jump target = pc + offset is a non-negative bytecode address by codegen invariant"
|
||||
)]
|
||||
pub(crate) fn op_jump_if_select_succeeded<'gc, M: Machine<'gc>>(
|
||||
_m: &mut M,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
|
||||
Reference in New Issue
Block a user