Fix linting issues in main February 2024 (#3595)
This commit is contained in:
parent
a182908fde
commit
2914641827
9 changed files with 36 additions and 50 deletions
|
@ -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;
|
||||
|
|
|
@ -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<Number>> {
|
||||
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)),
|
||||
)
|
||||
}
|
||||
}
|
|
@ -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<SharedVector>;
|
||||
|
|
|
@ -289,6 +289,7 @@ impl Complement<Array> for Array {
|
|||
|
||||
// ------------------------------
|
||||
|
||||
#[cfg_attr(feature = "sql2", allow(dead_code))]
|
||||
pub(crate) trait Concat<T> {
|
||||
fn concat(self, other: T) -> T;
|
||||
}
|
||||
|
@ -300,6 +301,12 @@ impl Concat<Array> for Array {
|
|||
}
|
||||
}
|
||||
|
||||
impl Concat<String> for String {
|
||||
fn concat(self, other: String) -> String {
|
||||
self + &other
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------
|
||||
|
||||
pub(crate) trait Difference<T> {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,10 +75,6 @@ impl<I: Clone> ParseError<I> {
|
|||
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,
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue