]> Repositorios git - scryer-prolog.git/commitdiff
fix clippy lints
authorSkgland <[email protected]>
Sat, 10 Jan 2026 16:52:34 +0000 (17:52 +0100)
committerBennet Bleßmann <[email protected]>
Sat, 10 Jan 2026 16:52:34 +0000 (17:52 +0100)
build/instructions_template.rs
src/codegen.rs
src/ffi.rs
src/machine/dispatch.rs
src/offset_table.rs
src/parser/ast.rs

index 277ce01053daec1b62f5773ed6bc5e5af346f241..06f71edbd73fed5fc3b9d90efabab6cbdde877b1 100644 (file)
@@ -1570,12 +1570,11 @@ pub fn generate_instructions_rs() -> TokenStream {
     let instr_macro_arms: Vec<_> = instr_data
         .instr_variants
         .iter()
-        .rev() // produce default, execute & default & execute cases first.
-        .cloned()
+        .rev()
         .map(|(name, arity, _, variant)| {
             let variant_ident = variant.ident.clone();
             let variant_string = variant.ident.to_string();
-            let arity = match arity {
+            let arity = match *arity {
                 Arity::Static(arity) => arity,
                 _ => 1,
             };
index 902f5b9f569e3cc74bbb234423722fa33b6662bb..c5a0c857a559c3c935152126196f4f68cb8abe27 100644 (file)
@@ -859,7 +859,7 @@ impl CodeGenerator {
                 let v = HeapCellValue::from(c);
 
                 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)));
                 compile_expr!(self, &terms[1], term_loc, code)
index 0d3521b8019a6a2700102e0be6a17e2efe7b1699..5545b397fc926b6728c5fb2b3619002a20926959 100644 (file)
@@ -975,6 +975,8 @@ pub enum FfiError {
     ArgCountMismatch {
         name: Atom, // ffi function or struct
         kind: ArgCountMismatchKind,
+        
+        #[allow(dead_code, reason = "will be used by PR 3173")]
         expected: usize,
         got: usize,
     },
index 8306c6e825109db5580b3aa93d1dfa44bcc392f3..cbf7d941b31fef9fe844030e106724550ba199b2 100644 (file)
@@ -847,11 +847,11 @@ impl MachineState {
     }
 
     #[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];
 
         let mut h = 0;
-        let mut string_cursor = string.as_str();
+        let mut string_cursor = string;
 
         if self.heap[0].is_stack_var() {
             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> {
         'outer: loop {
             for _ in 0..INSTRUCTIONS_PER_INTERRUPT_POLL {
-                match &self.code[self.machine_st.p] {
-                    &Instruction::BreakFromDispatchLoop => {
+                match self.code[self.machine_st.p] {
+                    Instruction::BreakFromDispatchLoop => {
                         break 'outer;
                     }
-                    &Instruction::GetLevel(r) => self.machine_st.get_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::Deallocate => self.machine_st.deallocate(),
-                    &Instruction::JmpByCall(offset) => {
+                    Instruction::GetLevel(r) => self.machine_st.get_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::Deallocate => self.machine_st.deallocate(),
+                    Instruction::JmpByCall(offset) => {
                         self.machine_st.p += offset;
                     }
-                    &Instruction::RevJmpBy(offset) => {
+                    Instruction::RevJmpBy(offset) => {
                         self.machine_st.p -= offset;
                     }
-                    &Instruction::GetConstant(_, c, reg) => {
+                    Instruction::GetConstant(_, c, reg) => {
                         self.machine_st.get_constant_instr(c, reg)
                     }
-                    &Instruction::GetList(_, reg) => self.machine_st.get_list_instr(reg),
-                    &Instruction::GetPartialString(_, ref string, reg) => {
+                    Instruction::GetList(_, reg) => self.machine_st.get_list_instr(reg),
+                    Instruction::GetPartialString(_, ref 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)
                     }
-                    &Instruction::GetVariable(norm, arg) => {
+                    Instruction::GetVariable(norm, arg) => {
                         self.machine_st.get_variable_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::UnifyLocalValue(reg) => {
+                    Instruction::GetValue(norm, arg) => self.machine_st.get_value_instr(norm, arg),
+                    Instruction::UnifyConstant(v) => self.machine_st.unify_constant_instr(v),
+                    Instruction::UnifyLocalValue(reg) => {
                         self.machine_st.unify_local_value_instr(reg)
                     }
-                    &Instruction::UnifyVariable(reg) => self.machine_st.unify_variable_instr(reg),
-                    &Instruction::UnifyValue(reg) => self.machine_st.unify_value_instr(reg),
-                    &Instruction::UnifyVoid(n) => self.machine_st.unify_void_instr(n),
-                    &Instruction::PutConstant(_, cell, reg) => {
+                    Instruction::UnifyVariable(reg) => self.machine_st.unify_variable_instr(reg),
+                    Instruction::UnifyValue(reg) => self.machine_st.unify_value_instr(reg),
+                    Instruction::UnifyVoid(n) => self.machine_st.unify_void_instr(n),
+                    Instruction::PutConstant(_, cell, reg) => {
                         self.machine_st.put_constant_instr(cell, reg)
                     }
-                    &Instruction::PutList(_, reg) => self.machine_st.put_list_instr(reg),
-                    &Instruction::PutPartialString(_, ref string, reg) => {
+                    Instruction::PutList(_, reg) => self.machine_st.put_list_instr(reg),
+                    Instruction::PutPartialString(_, ref 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)
                     }
-                    &Instruction::PutUnsafeValue(perm_slot, arg) => {
+                    Instruction::PutUnsafeValue(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::PutVariable(norm, arg) => {
+                    Instruction::PutValue(norm, arg) => self.machine_st.put_value_instr(norm, arg),
+                    Instruction::PutVariable(norm, arg) => {
                         self.machine_st.put_variable_instr(norm, arg)
                     }
-                    &Instruction::SetConstant(c) => self.machine_st.set_constant_instr(c),
-                    &Instruction::SetLocalValue(reg) => self.machine_st.set_local_value_instr(reg),
-                    &Instruction::SetVariable(reg) => self.machine_st.set_variable_instr(reg),
-                    &Instruction::SetValue(reg) => self.machine_st.set_value_instr(reg),
-                    &Instruction::SetVoid(n) => self.machine_st.set_void_instr(n),
+                    Instruction::SetConstant(c) => self.machine_st.set_constant_instr(c),
+                    Instruction::SetLocalValue(reg) => self.machine_st.set_local_value_instr(reg),
+                    Instruction::SetVariable(reg) => self.machine_st.set_variable_instr(reg),
+                    Instruction::SetValue(reg) => self.machine_st.set_value_instr(reg),
+                    Instruction::SetVoid(n) => self.machine_st.set_void_instr(n),
                     _ => return None,
                 }
             }
index ec3f6031ed67952f10a74ba3918fd55d2d3c3d98..c6fee00ddb443ccad6dba1ab7a13d0f0d1d0bfaf 100644 (file)
@@ -238,6 +238,7 @@ impl<T: RawBlockTraits> SerialOffsetTable<T> {
         &mut *self.block.base.add(offset).cast::<T>().cast_mut()
     }
 
+    #[allow(clippy::wrong_self_convention)]
     fn to_concurrent(&mut self) -> ConcurrentOffsetTable<T>
     where
         T: fmt::Debug,
index 3728da75f9a66bf7b74f38b32b60ae99942353bd..9fc54c706be78d2ea591c4f7d9d9c24b74824096 100644 (file)
@@ -250,6 +250,7 @@ pub enum GInteger {
 
 impl GInteger {
     #[inline]
+    #[allow(clippy::wrong_self_convention)]
     pub fn to_literal(self) -> Literal {
         match self {
             GInteger::Integer(integer) => Literal::Integer(integer),