diff --git a/core/src/fnc/util/math/mod.rs b/core/src/fnc/util/math/mod.rs index 9021daa3..13d0f425 100644 --- a/core/src/fnc/util/math/mod.rs +++ b/core/src/fnc/util/math/mod.rs @@ -11,7 +11,6 @@ pub mod midhinge; pub mod mode; pub mod nearestrank; pub mod percentile; -pub mod quartile; pub mod spread; pub mod top; pub mod trimean; diff --git a/core/src/fnc/util/math/quartile.rs b/core/src/fnc/util/math/quartile.rs deleted file mode 100644 index 78e637a6..00000000 --- a/core/src/fnc/util/math/quartile.rs +++ /dev/null @@ -1,19 +0,0 @@ -use super::percentile::Percentile; -use crate::sql::number::{Number, Sorted}; - -pub trait Quartile { - /// Divides the set of numbers into Q_0 (min), Q_1, Q_2, Q_3, and Q_4 (max) - fn quartile(self) -> (f64, f64, f64, f64, f64); -} - -impl Quartile for Sorted<&Vec> { - fn quartile(self) -> (f64, f64, f64, f64, f64) { - ( - self.percentile(Number::from(0)), - self.percentile(Number::from(25)), - self.percentile(Number::from(50)), - self.percentile(Number::from(75)), - self.percentile(Number::from(100)), - ) - } -} diff --git a/core/src/idx/trees/mtree.rs b/core/src/idx/trees/mtree.rs index 38c94db2..da2ed83c 100644 --- a/core/src/idx/trees/mtree.rs +++ b/core/src/idx/trees/mtree.rs @@ -25,6 +25,7 @@ use crate::idx::{IndexKeyBase, VersionedSerdeState}; use crate::kvs::{Key, Transaction, TransactionType, Val}; use crate::sql::index::{Distance, MTreeParams, VectorType}; use crate::sql::{Array, Object, Thing, Value}; + pub(crate) struct MTreeIndex { state_key: Key, dim: usize, @@ -491,7 +492,7 @@ impl MTree { } #[cfg_attr(not(target_arch = "wasm32"), async_recursion)] - #[cfg_attr(target_arch = "wasm32", async_recursion(?Send))] + #[cfg_attr(target_arch = "wasm32", async_recursion(? Send))] async fn insert_at_node( &mut self, tx: &mut Transaction, @@ -876,7 +877,7 @@ impl MTree { } #[cfg_attr(not(target_arch = "wasm32"), async_recursion)] - #[cfg_attr(target_arch = "wasm32", async_recursion(?Send))] + #[cfg_attr(target_arch = "wasm32", async_recursion(? Send))] #[allow(clippy::too_many_arguments)] async fn delete_at_node( &mut self, @@ -1406,7 +1407,9 @@ impl Display for MTreeNode { } } } + trait NodeVectors: Sized { + #[allow(dead_code)] fn len(&self) -> usize; fn get_objects(&self) -> Vec; diff --git a/core/src/sql/v2/array.rs b/core/src/sql/v2/array.rs index 51146dc3..8af1befa 100644 --- a/core/src/sql/v2/array.rs +++ b/core/src/sql/v2/array.rs @@ -289,6 +289,7 @@ impl Complement for Array { // ------------------------------ +#[cfg_attr(feature = "sql2", allow(dead_code))] pub(crate) trait Concat { fn concat(self, other: T) -> T; } @@ -300,6 +301,12 @@ impl Concat for Array { } } +impl Concat for String { + fn concat(self, other: String) -> String { + self + &other + } +} + // ------------------------------ pub(crate) trait Difference { diff --git a/core/src/sql/v2/expression.rs b/core/src/sql/v2/expression.rs index 20d5dd31..0ca6d1a7 100644 --- a/core/src/sql/v2/expression.rs +++ b/core/src/sql/v2/expression.rs @@ -126,22 +126,22 @@ impl Expression { let l = l.compute(ctx, opt, txn, doc).await?; match o { Operator::Or => { - if let true = l.is_truthy() { + if l.is_truthy() { return Ok(l); } } Operator::And => { - if let false = l.is_truthy() { + if !l.is_truthy() { return Ok(l); } } Operator::Tco => { - if let true = l.is_truthy() { + if l.is_truthy() { return Ok(l); } } Operator::Nco => { - if let true = l.is_some() { + if l.is_some() { return Ok(l); } } diff --git a/core/src/sql/v2/fmt.rs b/core/src/sql/v2/fmt.rs index ba57abef..43ab1017 100644 --- a/core/src/sql/v2/fmt.rs +++ b/core/src/sql/v2/fmt.rs @@ -153,11 +153,11 @@ thread_local! { // `thread_local!` so all accesses can use `Ordering::Relaxed`. /// Whether pretty-printing. - static PRETTY: AtomicBool = AtomicBool::new(false); + static PRETTY: AtomicBool = const {AtomicBool::new(false)}; /// The current level of indentation, in units of tabs. - static INDENT: AtomicU32 = AtomicU32::new(0); + static INDENT: AtomicU32 = const{AtomicU32::new(0)}; /// Whether the next formatting action should be preceded by a newline and indentation. - static NEW_LINE: AtomicBool = AtomicBool::new(false); + static NEW_LINE: AtomicBool = const{AtomicBool::new(false)}; } /// An adapter that, if enabled, adds pretty print formatting. diff --git a/core/src/sql/v2/regex.rs b/core/src/sql/v2/regex.rs index efbd175c..a1ab1b9b 100644 --- a/core/src/sql/v2/regex.rs +++ b/core/src/sql/v2/regex.rs @@ -61,7 +61,9 @@ impl FromStr for Regex { impl PartialEq for Regex { fn eq(&self, other: &Self) -> bool { - self.0.as_str().eq(other.0.as_str()) + let str_left = self.0.as_str(); + let str_right = other.0.as_str(); + str_left == str_right } } diff --git a/core/src/syn/error/nom_error.rs b/core/src/syn/error/nom_error.rs index 1d5ca6f8..05839a49 100644 --- a/core/src/syn/error/nom_error.rs +++ b/core/src/syn/error/nom_error.rs @@ -75,10 +75,6 @@ impl ParseError { ref tried, .. } - | Self::Expected { - ref tried, - .. - } | Self::Explained { ref tried, .. @@ -248,9 +244,9 @@ impl ParseError<&str> { ParseError::Field(tried, f) => { let location = Location::of_in(tried, input); let text = format!( - "Found '{f}' in SELECT clause at line {} column {}, but field is not an aggregate function, and is not present in GROUP BY expression", - location.line, location.column - ); + "Found '{f}' in SELECT clause at line {} column {}, but field is not an aggregate function, and is not present in GROUP BY expression", + location.line, location.column + ); let snippet = Snippet::from_source_location(input, location, None); RenderedError { text, @@ -260,9 +256,9 @@ impl ParseError<&str> { ParseError::Split(tried, f) => { let location = Location::of_in(tried, input); let text = format!( - "Found '{f}' in SPLIT ON clause at line {} column {}, but field is is not present in SELECT expression", - location.line, location.column - ); + "Found '{f}' in SPLIT ON clause at line {} column {}, but field is is not present in SELECT expression", + location.line, location.column + ); let snippet = Snippet::from_source_location(input, location, None); RenderedError { text, @@ -272,9 +268,9 @@ impl ParseError<&str> { ParseError::Order(tried, f) => { let location = Location::of_in(tried, input); let text = format!( - "Found '{f}' in ORDER BY clause at line {} column {}, but field is is not present in SELECT expression", - location.line, location.column - ); + "Found '{f}' in ORDER BY clause at line {} column {}, but field is is not present in SELECT expression", + location.line, location.column + ); let snippet = Snippet::from_source_location(input, location, None); RenderedError { text, @@ -284,9 +280,9 @@ impl ParseError<&str> { ParseError::Group(tried, f) => { let location = Location::of_in(tried, input); let text = format!( - "Found '{f}' in GROUP BY clause at line {} column {}, but field is is not present in SELECT expression", - location.line, location.column - ); + "Found '{f}' in GROUP BY clause at line {} column {}, but field is is not present in SELECT expression", + location.line, location.column + ); let snippet = Snippet::from_source_location(input, location, None); RenderedError { text, diff --git a/lib/tests/live.rs b/lib/tests/live.rs index f7efdc18..679eb86c 100644 --- a/lib/tests/live.rs +++ b/lib/tests/live.rs @@ -1,14 +1,12 @@ -mod parse; -use parse::Parse; mod helpers; +mod parse; + use helpers::new_ds; use surrealdb::dbs::Session; use surrealdb::err::Error; use surrealdb::sql::Value; use surrealdb_core::fflags::FFLAGS; -// RUST_LOG=trace cargo test -p surrealdb --features kv-mem --test live -- --nocapture - #[tokio::test] async fn live_query_sends_registered_lq_details() -> Result<(), Error> { if !FFLAGS.change_feed_live_queries.enabled() {