From: Bennet Bleßmann Date: Thu, 31 Jul 2025 19:28:30 +0000 (+0200) Subject: fix clone on copy values X-Git-Tag: v0.10.0~35^2~1^2~19 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=72631b3e0b10f317f92cab34aee558715292af42;p=scryer-prolog.git fix clone on copy values --- diff --git a/build/instructions_template.rs b/build/instructions_template.rs index 2f760ea1..31c329b9 100644 --- a/build/instructions_template.rs +++ b/build/instructions_template.rs @@ -1055,7 +1055,7 @@ fn generate_instruction_preface() -> TokenStream { constants.iter().map(|(c, ptr)| { functor!( atom!(":"), - [cell((c.clone())), indexing_code_ptr((*ptr))] + [cell((*c)), indexing_code_ptr((*ptr))] ) }), ) diff --git a/src/functor_macro.rs b/src/functor_macro.rs index 54bcb28c..591fa185 100644 --- a/src/functor_macro.rs +++ b/src/functor_macro.rs @@ -698,9 +698,9 @@ mod tests { let functor = variadic_functor( atom!("switch_on_constants"), 1, - constants.iter().map(|(c, ptr)| { - functor!(atom!(":"), [cell((c.clone())), indexing_code_ptr((*ptr))]) - }), + constants + .iter() + .map(|(c, ptr)| functor!(atom!(":"), [cell((*c)), indexing_code_ptr((*ptr))])), ); heap.truncate(0); diff --git a/src/machine/compile.rs b/src/machine/compile.rs index 7dcbee14..8e799009 100644 --- a/src/machine/compile.rs +++ b/src/machine/compile.rs @@ -133,7 +133,7 @@ fn merge_indices( ); retraction_info.push_record(RetractionRecord::AddedIndex( - skeleton[clause_index].opt_arg_index_key.clone(), + skeleton[clause_index].opt_arg_index_key, clause_loc, )); } else { @@ -246,7 +246,7 @@ fn remove_index_from_subsequence( // appear anywhere inside an Internal record. retraction_info.push_record(RetractionRecord::RemovedIndex( index_loc, - opt_arg_index_key.clone(), + *opt_arg_index_key, offset, )); } @@ -808,7 +808,7 @@ fn prepend_compiled_clause( skeleton.clauses[0].clause_start = clause_loc + 2; retraction_info.push_record(RetractionRecord::AddedIndex( - skeleton.clauses[0].opt_arg_index_key.clone(), + skeleton.clauses[0].opt_arg_index_key, skeleton.clauses[0].clause_start, )); @@ -1070,7 +1070,7 @@ fn append_compiled_clause( skeleton.clauses[target_pos].opt_arg_index_key += index_loc - 1; retraction_info.push_record(RetractionRecord::AddedIndex( - skeleton.clauses[target_pos].opt_arg_index_key.clone(), + skeleton.clauses[target_pos].opt_arg_index_key, skeleton.clauses[target_pos].clause_start, ));