No need to surround statements with an Arc

This commit is contained in:
Tobie Morgan Hitchcock 2022-05-17 00:12:58 +01:00
parent 82cbfad38d
commit 073285574a
2 changed files with 3 additions and 6 deletions

View file

@ -31,7 +31,6 @@ use rand::rngs::OsRng;
use rand::Rng; use rand::Rng;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt; use std::fmt;
use std::sync::Arc;
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Store)] #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Store)]
pub enum DefineStatement { pub enum DefineStatement {
@ -608,7 +607,7 @@ impl DefineTableStatement {
what: Values(vec![Value::Table(v.clone())]), what: Values(vec![Value::Table(v.clone())]),
..UpdateStatement::default() ..UpdateStatement::default()
}; };
Arc::new(stm).compute(ctx, opt, txn, doc).await?; stm.compute(ctx, opt, txn, doc).await?;
} }
} }
// Ok all good // Ok all good
@ -981,7 +980,7 @@ impl DefineIndexStatement {
what: Values(vec![Value::Table(self.what.clone().into())]), what: Values(vec![Value::Table(self.what.clone().into())]),
..UpdateStatement::default() ..UpdateStatement::default()
}; };
Arc::new(stm).compute(ctx, opt, txn, doc).await?; stm.compute(ctx, opt, txn, doc).await?;
// Ok all good // Ok all good
Ok(Value::None) Ok(Value::None)
} }

View file

@ -9,7 +9,6 @@ use crate::sql::statements::select::SelectStatement;
use crate::sql::value::{Value, Values}; use crate::sql::value::{Value, Values};
use async_recursion::async_recursion; use async_recursion::async_recursion;
use futures::future::try_join_all; use futures::future::try_join_all;
use std::sync::Arc;
impl Value { impl Value {
#[cfg_attr(feature = "parallel", async_recursion)] #[cfg_attr(feature = "parallel", async_recursion)]
@ -78,8 +77,7 @@ impl Value {
what: Values(vec![Value::Thing(v.clone())]), what: Values(vec![Value::Thing(v.clone())]),
..SelectStatement::default() ..SelectStatement::default()
}; };
Arc::new(stm) stm.compute(ctx, opt, txn, None)
.compute(ctx, opt, txn, None)
.await? .await?
.first() .first()
.get(ctx, opt, txn, path) .get(ctx, opt, txn, path)