remove two unecessary clones
This commit is contained in:
@@ -128,9 +128,11 @@ impl Term {
|
|||||||
pub fn try_conjunction(value: impl IntoIterator<Item = Term>) -> Option<Self> {
|
pub fn try_conjunction(value: impl IntoIterator<Item = Term>) -> Option<Self> {
|
||||||
let mut iter = value.into_iter();
|
let mut iter = value.into_iter();
|
||||||
iter.next().map(|first| {
|
iter.next().map(|first| {
|
||||||
Term::try_conjunction(iter)
|
if let Some(rest) = Term::try_conjunction(iter) {
|
||||||
.map(|rest| Term::compound(",", [first.clone(), rest]))
|
Term::compound(",", [first, rest])
|
||||||
.unwrap_or(first)
|
} else {
|
||||||
|
first
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,9 +145,11 @@ impl Term {
|
|||||||
pub fn try_disjunction(value: impl IntoIterator<Item = Term>) -> Option<Self> {
|
pub fn try_disjunction(value: impl IntoIterator<Item = Term>) -> Option<Self> {
|
||||||
let mut iter = value.into_iter();
|
let mut iter = value.into_iter();
|
||||||
iter.next().map(|first| {
|
iter.next().map(|first| {
|
||||||
Term::try_disjunction(iter)
|
if let Some(rest) = Term::try_disjunction(iter) {
|
||||||
.map(|rest| Term::compound(";", [first.clone(), rest]))
|
Term::compound(";", [first, rest])
|
||||||
.unwrap_or(first)
|
} else {
|
||||||
|
first
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user