Removed clone

This commit is contained in:
Erin 2021-12-14 23:05:21 +01:00 committed by ondra05
parent 8302324d0f
commit c1471bcdb7

View file

@ -408,19 +408,21 @@ impl ExecEnv {
}
Functio::Chain { functios, kind } => {
let (left_functio, right_functio) = *functios;
let (left_args, right_args) = match kind {
match kind {
crate::variables::FunctioChainKind::Equal => {
let (l, r) = args.split_at(args.len() / 2);
// TODO: avoid this clone
(l.to_owned(), r.to_owned())
self.fn_call_with_values(left_functio, l, span)?;
self.fn_call_with_values(right_functio, r, span)?;
}
crate::variables::FunctioChainKind::ByArity => {
Self::deinterlace(args, (left_functio.arity(), right_functio.arity()))
let (l, r) =
Self::deinterlace(args, (left_functio.arity(), right_functio.arity()));
self.fn_call_with_values(left_functio, &l, span)?;
self.fn_call_with_values(right_functio, &r, span)?;
}
};
self.fn_call_with_values(left_functio, &left_args, span)?;
self.fn_call_with_values(right_functio, &right_args, span)?;
}
Functio::Eval(code) => {
if !args.is_empty() {