From bf8651db29b532fe59e78185865aee2b562352b2 Mon Sep 17 00:00:00 2001 From: Skgland Date: Tue, 18 Nov 2025 21:27:23 +0100 Subject: [PATCH] remove two unecessary clones --- src/machine/lib_machine/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/machine/lib_machine/mod.rs b/src/machine/lib_machine/mod.rs index fc036940..653fc2a4 100644 --- a/src/machine/lib_machine/mod.rs +++ b/src/machine/lib_machine/mod.rs @@ -128,9 +128,11 @@ impl Term { pub fn try_conjunction(value: impl IntoIterator) -> Option { let mut iter = value.into_iter(); iter.next().map(|first| { - Term::try_conjunction(iter) - .map(|rest| Term::compound(",", [first.clone(), rest])) - .unwrap_or(first) + if let Some(rest) = Term::try_conjunction(iter) { + Term::compound(",", [first, rest]) + } else { + first + } }) } @@ -143,9 +145,11 @@ impl Term { pub fn try_disjunction(value: impl IntoIterator) -> Option { let mut iter = value.into_iter(); iter.next().map(|first| { - Term::try_disjunction(iter) - .map(|rest| Term::compound(";", [first.clone(), rest])) - .unwrap_or(first) + if let Some(rest) = Term::try_disjunction(iter) { + Term::compound(";", [first, rest]) + } else { + first + } }) } } -- 2.54.0