fix clippy lints

This commit is contained in:
Skgland
2026-01-10 17:52:34 +01:00
committed by Bennet Bleßmann
parent 73c26bed2a
commit eca4262be6
6 changed files with 40 additions and 37 deletions

View File

@@ -1570,12 +1570,11 @@ pub fn generate_instructions_rs() -> TokenStream {
let instr_macro_arms: Vec<_> = instr_data let instr_macro_arms: Vec<_> = instr_data
.instr_variants .instr_variants
.iter() .iter()
.rev() // produce default, execute & default & execute cases first. .rev()
.cloned()
.map(|(name, arity, _, variant)| { .map(|(name, arity, _, variant)| {
let variant_ident = variant.ident.clone(); let variant_ident = variant.ident.clone();
let variant_string = variant.ident.to_string(); let variant_string = variant.ident.to_string();
let arity = match arity { let arity = match *arity {
Arity::Static(arity) => arity, Arity::Static(arity) => arity,
_ => 1, _ => 1,
}; };

View File

@@ -859,7 +859,7 @@ impl CodeGenerator {
let v = HeapCellValue::from(c); let v = HeapCellValue::from(c);
self.marker self.marker
.mark_non_var::<QueryInstruction>(Level::Shallow, term_loc, &cell, code); .mark_non_var::<QueryInstruction>(Level::Shallow, term_loc, cell, code);
code.push_back(instr!("put_constant", Level::Shallow, v, temp_v!(1))); code.push_back(instr!("put_constant", Level::Shallow, v, temp_v!(1)));
compile_expr!(self, &terms[1], term_loc, code) compile_expr!(self, &terms[1], term_loc, code)

View File

@@ -975,6 +975,8 @@ pub enum FfiError {
ArgCountMismatch { ArgCountMismatch {
name: Atom, // ffi function or struct name: Atom, // ffi function or struct
kind: ArgCountMismatchKind, kind: ArgCountMismatchKind,
#[allow(dead_code, reason = "will be used by PR 3173")]
expected: usize, expected: usize,
got: usize, got: usize,
}, },

View File

@@ -847,11 +847,11 @@ impl MachineState {
} }
#[inline(always)] #[inline(always)]
fn get_partial_string_instr(&mut self, string: &String, r: RegType) { fn get_partial_string_instr(&mut self, string: &str, r: RegType) {
self.heap[0] = self[r]; self.heap[0] = self[r];
let mut h = 0; let mut h = 0;
let mut string_cursor = string.as_str(); let mut string_cursor = string;
if self.heap[0].is_stack_var() { if self.heap[0].is_stack_var() {
let cell = self.store(self.deref(self.heap[0])); let cell = self.store(self.deref(self.heap[0]));
@@ -1548,63 +1548,63 @@ impl Machine {
fn verify_attr_dispatch_loop(&mut self) -> Option<std::process::ExitCode> { fn verify_attr_dispatch_loop(&mut self) -> Option<std::process::ExitCode> {
'outer: loop { 'outer: loop {
for _ in 0..INSTRUCTIONS_PER_INTERRUPT_POLL { for _ in 0..INSTRUCTIONS_PER_INTERRUPT_POLL {
match &self.code[self.machine_st.p] { match self.code[self.machine_st.p] {
&Instruction::BreakFromDispatchLoop => { Instruction::BreakFromDispatchLoop => {
break 'outer; break 'outer;
} }
&Instruction::GetLevel(r) => self.machine_st.get_level_instr(r), Instruction::GetLevel(r) => self.machine_st.get_level_instr(r),
&Instruction::GetPrevLevel(r) => self.machine_st.get_prev_level_instr(r), Instruction::GetPrevLevel(r) => self.machine_st.get_prev_level_instr(r),
&Instruction::GetCutPoint(r) => self.machine_st.get_cut_point_instr(r), Instruction::GetCutPoint(r) => self.machine_st.get_cut_point_instr(r),
&Instruction::Deallocate => self.machine_st.deallocate(), Instruction::Deallocate => self.machine_st.deallocate(),
&Instruction::JmpByCall(offset) => { Instruction::JmpByCall(offset) => {
self.machine_st.p += offset; self.machine_st.p += offset;
} }
&Instruction::RevJmpBy(offset) => { Instruction::RevJmpBy(offset) => {
self.machine_st.p -= offset; self.machine_st.p -= offset;
} }
&Instruction::GetConstant(_, c, reg) => { Instruction::GetConstant(_, c, reg) => {
self.machine_st.get_constant_instr(c, reg) self.machine_st.get_constant_instr(c, reg)
} }
&Instruction::GetList(_, reg) => self.machine_st.get_list_instr(reg), Instruction::GetList(_, reg) => self.machine_st.get_list_instr(reg),
&Instruction::GetPartialString(_, ref string, reg) => { Instruction::GetPartialString(_, ref string, reg) => {
self.machine_st.get_partial_string_instr(string, reg) self.machine_st.get_partial_string_instr(string, reg)
} }
&Instruction::GetStructure(_lvl, name, arity, reg) => { Instruction::GetStructure(_lvl, name, arity, reg) => {
self.machine_st.get_structure_instr(name, arity, reg) self.machine_st.get_structure_instr(name, arity, reg)
} }
&Instruction::GetVariable(norm, arg) => { Instruction::GetVariable(norm, arg) => {
self.machine_st.get_variable_instr(norm, arg) self.machine_st.get_variable_instr(norm, arg)
} }
&Instruction::GetValue(norm, arg) => self.machine_st.get_value_instr(norm, arg), Instruction::GetValue(norm, arg) => self.machine_st.get_value_instr(norm, arg),
&Instruction::UnifyConstant(v) => self.machine_st.unify_constant_instr(v), Instruction::UnifyConstant(v) => self.machine_st.unify_constant_instr(v),
&Instruction::UnifyLocalValue(reg) => { Instruction::UnifyLocalValue(reg) => {
self.machine_st.unify_local_value_instr(reg) self.machine_st.unify_local_value_instr(reg)
} }
&Instruction::UnifyVariable(reg) => self.machine_st.unify_variable_instr(reg), Instruction::UnifyVariable(reg) => self.machine_st.unify_variable_instr(reg),
&Instruction::UnifyValue(reg) => self.machine_st.unify_value_instr(reg), Instruction::UnifyValue(reg) => self.machine_st.unify_value_instr(reg),
&Instruction::UnifyVoid(n) => self.machine_st.unify_void_instr(n), Instruction::UnifyVoid(n) => self.machine_st.unify_void_instr(n),
&Instruction::PutConstant(_, cell, reg) => { Instruction::PutConstant(_, cell, reg) => {
self.machine_st.put_constant_instr(cell, reg) self.machine_st.put_constant_instr(cell, reg)
} }
&Instruction::PutList(_, reg) => self.machine_st.put_list_instr(reg), Instruction::PutList(_, reg) => self.machine_st.put_list_instr(reg),
&Instruction::PutPartialString(_, ref string, reg) => { Instruction::PutPartialString(_, ref string, reg) => {
self.machine_st.put_partial_string_instr(string, reg) self.machine_st.put_partial_string_instr(string, reg)
} }
&Instruction::PutStructure(name, arity, reg) => { Instruction::PutStructure(name, arity, reg) => {
self.machine_st.put_structure_instr(name, arity, reg) self.machine_st.put_structure_instr(name, arity, reg)
} }
&Instruction::PutUnsafeValue(perm_slot, arg) => { Instruction::PutUnsafeValue(perm_slot, arg) => {
self.machine_st.put_unsafe_value_instr(perm_slot, arg) self.machine_st.put_unsafe_value_instr(perm_slot, arg)
} }
&Instruction::PutValue(norm, arg) => self.machine_st.put_value_instr(norm, arg), Instruction::PutValue(norm, arg) => self.machine_st.put_value_instr(norm, arg),
&Instruction::PutVariable(norm, arg) => { Instruction::PutVariable(norm, arg) => {
self.machine_st.put_variable_instr(norm, arg) self.machine_st.put_variable_instr(norm, arg)
} }
&Instruction::SetConstant(c) => self.machine_st.set_constant_instr(c), Instruction::SetConstant(c) => self.machine_st.set_constant_instr(c),
&Instruction::SetLocalValue(reg) => self.machine_st.set_local_value_instr(reg), Instruction::SetLocalValue(reg) => self.machine_st.set_local_value_instr(reg),
&Instruction::SetVariable(reg) => self.machine_st.set_variable_instr(reg), Instruction::SetVariable(reg) => self.machine_st.set_variable_instr(reg),
&Instruction::SetValue(reg) => self.machine_st.set_value_instr(reg), Instruction::SetValue(reg) => self.machine_st.set_value_instr(reg),
&Instruction::SetVoid(n) => self.machine_st.set_void_instr(n), Instruction::SetVoid(n) => self.machine_st.set_void_instr(n),
_ => return None, _ => return None,
} }
} }

View File

@@ -238,6 +238,7 @@ impl<T: RawBlockTraits> SerialOffsetTable<T> {
&mut *self.block.base.add(offset).cast::<T>().cast_mut() &mut *self.block.base.add(offset).cast::<T>().cast_mut()
} }
#[allow(clippy::wrong_self_convention)]
fn to_concurrent(&mut self) -> ConcurrentOffsetTable<T> fn to_concurrent(&mut self) -> ConcurrentOffsetTable<T>
where where
T: fmt::Debug, T: fmt::Debug,

View File

@@ -250,6 +250,7 @@ pub enum GInteger {
impl GInteger { impl GInteger {
#[inline] #[inline]
#[allow(clippy::wrong_self_convention)]
pub fn to_literal(self) -> Literal { pub fn to_literal(self) -> Literal {
match self { match self {
GInteger::Integer(integer) => Literal::Integer(integer), GInteger::Integer(integer) => Literal::Integer(integer),