Update clippy linting tests
This commit is contained in:
parent
cf11eb7f54
commit
84b026679f
34 changed files with 158 additions and 165 deletions
|
@ -65,12 +65,12 @@ impl<'a> From<&'a InsertStatement> for Statement<'a> {
|
|||
impl<'a> fmt::Display for Statement<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Statement::Select(v) => write!(f, "{}", v),
|
||||
Statement::Create(v) => write!(f, "{}", v),
|
||||
Statement::Update(v) => write!(f, "{}", v),
|
||||
Statement::Relate(v) => write!(f, "{}", v),
|
||||
Statement::Delete(v) => write!(f, "{}", v),
|
||||
Statement::Insert(v) => write!(f, "{}", v),
|
||||
Statement::Select(v) => write!(f, "{v}"),
|
||||
Statement::Create(v) => write!(f, "{v}"),
|
||||
Statement::Update(v) => write!(f, "{v}"),
|
||||
Statement::Relate(v) => write!(f, "{v}"),
|
||||
Statement::Delete(v) => write!(f, "{v}"),
|
||||
Statement::Insert(v) => write!(f, "{v}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ pub fn md5((arg,): (String,)) -> Result<Value, Error> {
|
|||
let mut hasher = Md5::new();
|
||||
hasher.update(arg.as_str());
|
||||
let val = hasher.finalize();
|
||||
let val = format!("{:x}", val);
|
||||
let val = format!("{val:x}");
|
||||
Ok(val.into())
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub fn sha1((arg,): (String,)) -> Result<Value, Error> {
|
|||
let mut hasher = Sha1::new();
|
||||
hasher.update(arg.as_str());
|
||||
let val = hasher.finalize();
|
||||
let val = format!("{:x}", val);
|
||||
let val = format!("{val:x}");
|
||||
Ok(val.into())
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub fn sha256((arg,): (String,)) -> Result<Value, Error> {
|
|||
let mut hasher = Sha256::new();
|
||||
hasher.update(arg.as_str());
|
||||
let val = hasher.finalize();
|
||||
let val = format!("{:x}", val);
|
||||
let val = format!("{val:x}");
|
||||
Ok(val.into())
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ pub fn sha512((arg,): (String,)) -> Result<Value, Error> {
|
|||
let mut hasher = Sha512::new();
|
||||
hasher.update(arg.as_str());
|
||||
let val = hasher.finalize();
|
||||
let val = format!("{:x}", val);
|
||||
let val = format!("{val:x}");
|
||||
Ok(val.into())
|
||||
}
|
||||
|
||||
|
|
|
@ -52,12 +52,12 @@ pub fn guid((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error> {
|
|||
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max as usize..=min as usize),
|
||||
_ => return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::guid"),
|
||||
message: format!("To generate a guid of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a guid of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||
}),
|
||||
},
|
||||
_ => return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::guid"),
|
||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||
}),
|
||||
}
|
||||
} else if let Some(len) = arg1 {
|
||||
|
@ -66,7 +66,7 @@ pub fn guid((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error> {
|
|||
} else {
|
||||
return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::guid"),
|
||||
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {LIMIT}."),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -100,12 +100,12 @@ pub fn string((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error>
|
|||
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max as usize..=min as usize),
|
||||
_ => return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::string"),
|
||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||
}),
|
||||
},
|
||||
_ => return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::string"),
|
||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a string of between X and Y characters in length, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||
}),
|
||||
}
|
||||
} else if let Some(len) = arg1 {
|
||||
|
@ -114,7 +114,7 @@ pub fn string((arg1, arg2): (Option<i64>, Option<i64>)) -> Result<Value, Error>
|
|||
} else {
|
||||
return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::string"),
|
||||
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a string of X characters in length, the argument must be a positive number and no higher than {LIMIT}."),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -135,12 +135,12 @@ pub fn time((range,): (Option<(i64, i64)>,)) -> Result<Value, Error> {
|
|||
max if max >= 1 && max <= min => rand::thread_rng().gen_range(max..=min),
|
||||
_ => return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::time"),
|
||||
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||
}),
|
||||
},
|
||||
_ => return Err(Error::InvalidArguments {
|
||||
name: String::from("rand::time"),
|
||||
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {}.", LIMIT),
|
||||
message: format!("To generate a time between X and Y seconds, the 2 arguments must be positive numbers and no higher than {LIMIT}."),
|
||||
}),
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -12,7 +12,7 @@ impl From<js::Error> for Error {
|
|||
message: format!(
|
||||
"An exception occurred{}: {}{}",
|
||||
match file.is_empty() {
|
||||
false => format!(" at {}:{}", file, line),
|
||||
false => format!(" at {file}:{line}"),
|
||||
true => String::default(),
|
||||
},
|
||||
match message.is_empty() {
|
||||
|
@ -20,7 +20,7 @@ impl From<js::Error> for Error {
|
|||
true => String::default(),
|
||||
},
|
||||
match stack.is_empty() {
|
||||
false => format!("\n{}", stack),
|
||||
false => format!("\n{stack}"),
|
||||
true => String::default(),
|
||||
}
|
||||
),
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn repeat((val, num): (String, usize)) -> Result<Value, Error> {
|
|||
if val.len().saturating_mul(num) > LIMIT {
|
||||
Err(Error::InvalidArguments {
|
||||
name: String::from("string::repeat"),
|
||||
message: format!("Output must not exceed {} bytes.", LIMIT),
|
||||
message: format!("Output must not exceed {LIMIT} bytes."),
|
||||
})
|
||||
} else {
|
||||
Ok(val.repeat(num).into())
|
||||
|
|
|
@ -1334,7 +1334,7 @@ impl Transaction {
|
|||
chn.send(bytes!("-- ------------------------------")).await?;
|
||||
chn.send(bytes!("")).await?;
|
||||
for dl in dls.iter() {
|
||||
chn.send(bytes!(format!("{};", dl))).await?;
|
||||
chn.send(bytes!(format!("{dl};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1348,7 +1348,7 @@ impl Transaction {
|
|||
chn.send(bytes!("-- ------------------------------")).await?;
|
||||
chn.send(bytes!("")).await?;
|
||||
for dt in dts.iter() {
|
||||
chn.send(bytes!(format!("{};", dt))).await?;
|
||||
chn.send(bytes!(format!("{dt};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1362,7 +1362,7 @@ impl Transaction {
|
|||
chn.send(bytes!("-- ------------------------------")).await?;
|
||||
chn.send(bytes!("")).await?;
|
||||
for sc in scs.iter() {
|
||||
chn.send(bytes!(format!("{};", sc))).await?;
|
||||
chn.send(bytes!(format!("{sc};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ impl Transaction {
|
|||
chn.send(bytes!("-- ------------------------------")).await?;
|
||||
chn.send(bytes!("")).await?;
|
||||
for pa in pas.iter() {
|
||||
chn.send(bytes!(format!("{};", pa))).await?;
|
||||
chn.send(bytes!(format!("{pa};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1391,14 +1391,14 @@ impl Transaction {
|
|||
chn.send(bytes!(format!("-- TABLE: {}", tb.name))).await?;
|
||||
chn.send(bytes!("-- ------------------------------")).await?;
|
||||
chn.send(bytes!("")).await?;
|
||||
chn.send(bytes!(format!("{};", tb))).await?;
|
||||
chn.send(bytes!(format!("{tb};"))).await?;
|
||||
chn.send(bytes!("")).await?;
|
||||
// Output FIELDS
|
||||
{
|
||||
let fds = self.all_fd(ns, db, &tb.name).await?;
|
||||
if !fds.is_empty() {
|
||||
for fd in fds.iter() {
|
||||
chn.send(bytes!(format!("{};", fd))).await?;
|
||||
chn.send(bytes!(format!("{fd};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1407,7 +1407,7 @@ impl Transaction {
|
|||
let ixs = self.all_ix(ns, db, &tb.name).await?;
|
||||
if !ixs.is_empty() {
|
||||
for ix in ixs.iter() {
|
||||
chn.send(bytes!(format!("{};", ix))).await?;
|
||||
chn.send(bytes!(format!("{ix};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1415,7 +1415,7 @@ impl Transaction {
|
|||
let evs = self.all_ev(ns, db, &tb.name).await?;
|
||||
if !evs.is_empty() {
|
||||
for ev in evs.iter() {
|
||||
chn.send(bytes!(format!("{};", ev))).await?;
|
||||
chn.send(bytes!(format!("{ev};"))).await?;
|
||||
}
|
||||
chn.send(bytes!("")).await?;
|
||||
}
|
||||
|
@ -1473,15 +1473,12 @@ impl Transaction {
|
|||
match (v.pick(&*EDGE), v.pick(&*IN), v.pick(&*OUT)) {
|
||||
// This is a graph edge record
|
||||
(Value::True, Value::Thing(l), Value::Thing(r)) => {
|
||||
let sql = format!(
|
||||
"RELATE {} -> {} -> {} CONTENT {};",
|
||||
l, t, r, v
|
||||
);
|
||||
let sql = format!("RELATE {l} -> {t} -> {r} CONTENT {v};",);
|
||||
chn.send(bytes!(sql)).await?;
|
||||
}
|
||||
// This is a normal record
|
||||
_ => {
|
||||
let sql = format!("UPDATE {} CONTENT {};", t, v);
|
||||
let sql = format!("UPDATE {t} CONTENT {v};");
|
||||
chn.send(bytes!(sql)).await?;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ impl fmt::Display for Base {
|
|||
match self {
|
||||
Self::Ns => f.write_str("NAMESPACE"),
|
||||
Self::Db => f.write_str("DATABASE"),
|
||||
Self::Sc(sc) => write!(f, "SCOPE {}", sc),
|
||||
Self::Sc(sc) => write!(f, "SCOPE {sc}"),
|
||||
Self::Kv => f.write_str("KV"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,16 +80,14 @@ impl Display for Data {
|
|||
Self::SetExpression(v) => write!(
|
||||
f,
|
||||
"SET {}",
|
||||
Fmt::comma_separated(v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(
|
||||
f,
|
||||
"{} {} {}",
|
||||
l, o, r
|
||||
))))
|
||||
Fmt::comma_separated(
|
||||
v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(f, "{l} {o} {r}",)))
|
||||
)
|
||||
),
|
||||
Self::PatchExpression(v) => write!(f, "PATCH {}", v),
|
||||
Self::MergeExpression(v) => write!(f, "MERGE {}", v),
|
||||
Self::ReplaceExpression(v) => write!(f, "REPLACE {}", v),
|
||||
Self::ContentExpression(v) => write!(f, "CONTENT {}", v),
|
||||
Self::PatchExpression(v) => write!(f, "PATCH {v}"),
|
||||
Self::MergeExpression(v) => write!(f, "MERGE {v}"),
|
||||
Self::ReplaceExpression(v) => write!(f, "REPLACE {v}"),
|
||||
Self::ContentExpression(v) => write!(f, "CONTENT {v}"),
|
||||
Self::SingleExpression(v) => Display::fmt(v, f),
|
||||
Self::ValuesExpression(v) => write!(
|
||||
f,
|
||||
|
@ -104,11 +102,9 @@ impl Display for Data {
|
|||
Self::UpdateExpression(v) => write!(
|
||||
f,
|
||||
"ON DUPLICATE KEY UPDATE {}",
|
||||
Fmt::comma_separated(v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(
|
||||
f,
|
||||
"{} {} {}",
|
||||
l, o, r
|
||||
))))
|
||||
Fmt::comma_separated(
|
||||
v.iter().map(|args| Fmt::new(args, |(l, o, r), f| write!(f, "{l} {o} {r}",)))
|
||||
)
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ pub fn escape_str(s: &str) -> Cow<'_, str> {
|
|||
if s.contains(SINGLE) {
|
||||
escape_normal(s, DOUBLE, DOUBLE, DOUBLE_ESC)
|
||||
} else {
|
||||
Cow::Owned(format!("{}{}{}", SINGLE, s, SINGLE))
|
||||
Cow::Owned(format!("{SINGLE}{s}{SINGLE}"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ pub fn escape_normal<'a>(s: &'a str, l: char, r: char, e: &str) -> Cow<'a, str>
|
|||
for x in s.bytes() {
|
||||
// Check if character is allowed
|
||||
if !val_u8(x) {
|
||||
return Cow::Owned(format!("{}{}{}", l, s.replace(r, e), r));
|
||||
return Cow::Owned(format!("{l}{}{r}", s.replace(r, e)));
|
||||
}
|
||||
}
|
||||
// Output the value
|
||||
|
@ -62,7 +62,7 @@ pub fn escape_numeric<'a>(s: &'a str, l: char, r: char, e: &str) -> Cow<'a, str>
|
|||
for x in s.bytes() {
|
||||
// Check if character is allowed
|
||||
if !val_u8(x) {
|
||||
return Cow::Owned(format!("{}{}{}", l, s.replace(r, e), r));
|
||||
return Cow::Owned(format!("{l}{}{r}", s.replace(r, e)));
|
||||
}
|
||||
// Check if character is non-numeric
|
||||
if !is_digit(x) {
|
||||
|
@ -72,7 +72,7 @@ pub fn escape_numeric<'a>(s: &'a str, l: char, r: char, e: &str) -> Cow<'a, str>
|
|||
// Output the id value
|
||||
match numeric {
|
||||
// This is numeric so escape it
|
||||
true => Cow::Owned(format!("{}{}{}", l, s.replace(r, e), r)),
|
||||
true => Cow::Owned(format!("{l}{}{r}", s.replace(r, e))),
|
||||
// No need to escape the value
|
||||
_ => Cow::Borrowed(s),
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ impl Display for Field {
|
|||
match self {
|
||||
Self::All => f.write_char('*'),
|
||||
Self::Alone(e) => Display::fmt(e, f),
|
||||
Self::Alias(e, a) => write!(f, "{} AS {}", e, a),
|
||||
Self::Alias(e, a) => write!(f, "{e} AS {a}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,11 +151,11 @@ impl Function {
|
|||
impl fmt::Display for Function {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::Cast(ref s, ref e) => write!(f, "<{}> {}", s, e),
|
||||
Self::Cast(ref s, ref e) => write!(f, "<{s}> {e}"),
|
||||
Self::Script(ref s, ref e) => {
|
||||
write!(f, "function({}) {{{}}}", Fmt::comma_separated(e), s)
|
||||
write!(f, "function({}) {{{s}}}", Fmt::comma_separated(e))
|
||||
}
|
||||
Self::Normal(ref s, ref e) => write!(f, "{}({})", s, Fmt::comma_separated(e)),
|
||||
Self::Normal(ref s, ref e) => write!(f, "{s}({})", Fmt::comma_separated(e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@ impl Display for Graph {
|
|||
_ => Display::fmt(&self.what, f),
|
||||
}?;
|
||||
if let Some(ref v) = self.cond {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.alias {
|
||||
write!(f, " AS {}", v)?
|
||||
write!(f, " AS {v}")?
|
||||
}
|
||||
f.write_char(')')
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ impl Idiom {
|
|||
}
|
||||
/// Convert this Idiom to a JSON Path string
|
||||
pub(crate) fn to_path(&self) -> String {
|
||||
format!("/{}", self).replace(']', "").replace(&['.', '['][..], "/")
|
||||
format!("/{self}").replace(']', "").replace(&['.', '['][..], "/")
|
||||
}
|
||||
/// Simplifies this Idiom for use in object keys
|
||||
pub(crate) fn simplify(&self) -> Idiom {
|
||||
|
|
|
@ -391,9 +391,9 @@ impl Number {
|
|||
|
||||
pub fn fixed(self, precision: usize) -> Number {
|
||||
match self {
|
||||
Number::Int(v) => format!("{:.1$}", v, precision).into(),
|
||||
Number::Float(v) => format!("{:.1$}", v, precision).into(),
|
||||
Number::Decimal(v) => format!("{:.1$}", v, precision).into(),
|
||||
Number::Int(v) => format!("{v:.precision$}").into(),
|
||||
Number::Float(v) => format!("{v:.precision$}").into(),
|
||||
Number::Decimal(v) => format!("{v:.precision$}").into(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,11 +106,11 @@ impl fmt::Display for Part {
|
|||
Part::All => f.write_str("[*]"),
|
||||
Part::Last => f.write_str("[$]"),
|
||||
Part::First => f.write_str("[0]"),
|
||||
Part::Field(v) => write!(f, ".{}", v),
|
||||
Part::Index(v) => write!(f, "[{}]", v),
|
||||
Part::Where(v) => write!(f, "[WHERE {}]", v),
|
||||
Part::Thing(v) => write!(f, "{}", v),
|
||||
Part::Graph(v) => write!(f, "{}", v),
|
||||
Part::Field(v) => write!(f, ".{v}"),
|
||||
Part::Index(v) => write!(f, "[{v}]"),
|
||||
Part::Where(v) => write!(f, "[WHERE {v}]"),
|
||||
Part::Thing(v) => write!(f, "{v}"),
|
||||
Part::Graph(v) => write!(f, "{v}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ impl Display for Permissions {
|
|||
let _indent = pretty_indent();
|
||||
Display::fmt(permission, f)?;
|
||||
}
|
||||
_ => write!(f, " {}", permission)?,
|
||||
_ => write!(f, " {permission}")?,
|
||||
}
|
||||
}
|
||||
drop(indent);
|
||||
|
@ -198,7 +198,7 @@ impl Display for Permission {
|
|||
match self {
|
||||
Self::None => f.write_str("NONE"),
|
||||
Self::Full => f.write_str("FULL"),
|
||||
Self::Specific(ref v) => write!(f, "WHERE {}", v),
|
||||
Self::Specific(ref v) => write!(f, "WHERE {v}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,13 +110,13 @@ impl fmt::Display for Range {
|
|||
write!(f, "{}:", self.tb)?;
|
||||
match &self.beg {
|
||||
Bound::Unbounded => write!(f, ""),
|
||||
Bound::Included(id) => write!(f, "{}", id),
|
||||
Bound::Excluded(id) => write!(f, "{}>", id),
|
||||
Bound::Included(id) => write!(f, "{id}"),
|
||||
Bound::Excluded(id) => write!(f, "{id}>"),
|
||||
}?;
|
||||
match &self.end {
|
||||
Bound::Unbounded => write!(f, ".."),
|
||||
Bound::Excluded(id) => write!(f, "..{}", id),
|
||||
Bound::Included(id) => write!(f, "..={}", id),
|
||||
Bound::Excluded(id) => write!(f, "..{id}"),
|
||||
Bound::Included(id) => write!(f, "..={id}"),
|
||||
}?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ impl fmt::Display for Statements {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
Display::fmt(
|
||||
&Fmt::pretty_new_line_separated(
|
||||
self.0.iter().map(|v| Fmt::new(v, |v, f| write!(f, "{};", v))),
|
||||
self.0.iter().map(|v| Fmt::new(v, |v, f| write!(f, "{v};"))),
|
||||
),
|
||||
f,
|
||||
)
|
||||
|
@ -152,25 +152,25 @@ impl Statement {
|
|||
impl Display for Statement {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::Use(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Set(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Info(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Live(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Kill(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Begin(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Cancel(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Commit(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Output(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Ifelse(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Select(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Create(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Update(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Relate(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Delete(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Insert(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Define(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Remove(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Option(v) => write!(Pretty::from(f), "{}", v),
|
||||
Self::Use(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Set(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Info(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Live(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Kill(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Begin(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Cancel(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Commit(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Output(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Ifelse(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Select(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Create(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Update(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Relate(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Delete(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Insert(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Define(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Remove(v) => write!(Pretty::from(f), "{v}"),
|
||||
Self::Option(v) => write!(Pretty::from(f), "{v}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,13 +121,13 @@ impl fmt::Display for CreateStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "CREATE {}", self.what)?;
|
||||
if let Some(ref v) = self.data {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.output {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if self.parallel {
|
||||
f.write_str(" PARALLEL")?
|
||||
|
|
|
@ -492,13 +492,13 @@ impl fmt::Display for DefineScopeStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "DEFINE SCOPE {}", self.name)?;
|
||||
if let Some(ref v) = self.session {
|
||||
write!(f, " SESSION {}", v)?
|
||||
write!(f, " SESSION {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.signup {
|
||||
write!(f, " SIGNUP {}", v)?
|
||||
write!(f, " SIGNUP {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.signin {
|
||||
write!(f, " SIGNIN {}", v)?
|
||||
write!(f, " SIGNIN {v}")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ impl fmt::Display for DefineTableStatement {
|
|||
" SCHEMALESS"
|
||||
})?;
|
||||
if let Some(ref v) = self.view {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if !self.permissions.is_full() {
|
||||
let _indent = if is_pretty() {
|
||||
|
@ -951,13 +951,13 @@ impl fmt::Display for DefineFieldStatement {
|
|||
write!(f, " FLEXIBLE")?
|
||||
}
|
||||
if let Some(ref v) = self.kind {
|
||||
write!(f, " TYPE {}", v)?
|
||||
write!(f, " TYPE {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.value {
|
||||
write!(f, " VALUE {}", v)?
|
||||
write!(f, " VALUE {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.assert {
|
||||
write!(f, " ASSERT {}", v)?
|
||||
write!(f, " ASSERT {v}")?
|
||||
}
|
||||
if !self.permissions.is_full() {
|
||||
write!(f, " {}", self.permissions)?;
|
||||
|
|
|
@ -115,13 +115,13 @@ impl fmt::Display for DeleteStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "DELETE {}", self.what)?;
|
||||
if let Some(ref v) = self.cond {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.output {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if self.parallel {
|
||||
f.write_str(" PARALLEL")?
|
||||
|
|
|
@ -55,14 +55,14 @@ impl Display for IfelseStatement {
|
|||
Display::fmt(
|
||||
&Fmt::new(
|
||||
self.exprs.iter().map(|args| {
|
||||
Fmt::new(args, |(cond, then), f| write!(f, "IF {} THEN {}", cond, then))
|
||||
Fmt::new(args, |(cond, then), f| write!(f, "IF {cond} THEN {then}"))
|
||||
}),
|
||||
fmt_separated_by(" ELSE "),
|
||||
),
|
||||
f,
|
||||
)?;
|
||||
if let Some(ref v) = self.close {
|
||||
write!(f, " ELSE {}", v)?
|
||||
write!(f, " ELSE {v}")?
|
||||
}
|
||||
f.write_str(" END")?;
|
||||
Ok(())
|
||||
|
|
|
@ -197,8 +197,8 @@ impl fmt::Display for InfoStatement {
|
|||
Self::Kv => f.write_str("INFO FOR KV"),
|
||||
Self::Ns => f.write_str("INFO FOR NAMESPACE"),
|
||||
Self::Db => f.write_str("INFO FOR DATABASE"),
|
||||
Self::Sc(ref s) => write!(f, "INFO FOR SCOPE {}", s),
|
||||
Self::Tb(ref t) => write!(f, "INFO FOR TABLE {}", t),
|
||||
Self::Sc(ref s) => write!(f, "INFO FOR SCOPE {s}"),
|
||||
Self::Tb(ref t) => write!(f, "INFO FOR TABLE {t}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,10 +112,10 @@ impl fmt::Display for InsertStatement {
|
|||
}
|
||||
write!(f, " INTO {} {}", self.into, self.data)?;
|
||||
if let Some(ref v) = self.output {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if self.parallel {
|
||||
f.write_str(" PARALLEL")?
|
||||
|
|
|
@ -73,10 +73,10 @@ impl fmt::Display for LiveStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "LIVE SELECT {} FROM {}", self.expr, self.what)?;
|
||||
if let Some(ref v) = self.cond {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.fetch {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ impl fmt::Display for OutputStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "RETURN {}", self.what)?;
|
||||
if let Some(ref v) = self.fetch {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -182,13 +182,13 @@ impl fmt::Display for RelateStatement {
|
|||
f.write_str(" UNIQUE")?
|
||||
}
|
||||
if let Some(ref v) = self.data {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.output {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if self.parallel {
|
||||
f.write_str(" PARALLEL")?
|
||||
|
|
|
@ -130,31 +130,31 @@ impl fmt::Display for SelectStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "SELECT {} FROM {}", self.expr, self.what)?;
|
||||
if let Some(ref v) = self.cond {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.split {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.group {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.order {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.limit {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.start {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.fetch {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.version {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if self.parallel {
|
||||
f.write_str(" PARALLEL")?
|
||||
|
|
|
@ -116,16 +116,16 @@ impl fmt::Display for UpdateStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "UPDATE {}", self.what)?;
|
||||
if let Some(ref v) = self.data {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.cond {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.output {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.timeout {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if self.parallel {
|
||||
f.write_str(" PARALLEL")?
|
||||
|
|
|
@ -17,10 +17,10 @@ impl fmt::Display for UseStatement {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.write_str("USE")?;
|
||||
if let Some(ref ns) = self.ns {
|
||||
write!(f, " NS {}", ns)?;
|
||||
write!(f, " NS {ns}")?;
|
||||
}
|
||||
if let Some(ref db) = self.db {
|
||||
write!(f, " DB {}", db)?;
|
||||
write!(f, " DB {db}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -174,13 +174,13 @@ impl Subquery {
|
|||
impl Display for Subquery {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::Value(v) => write!(f, "({})", v),
|
||||
Self::Select(v) => write!(f, "({})", v),
|
||||
Self::Create(v) => write!(f, "({})", v),
|
||||
Self::Update(v) => write!(f, "({})", v),
|
||||
Self::Delete(v) => write!(f, "({})", v),
|
||||
Self::Relate(v) => write!(f, "({})", v),
|
||||
Self::Insert(v) => write!(f, "({})", v),
|
||||
Self::Value(v) => write!(f, "({v})"),
|
||||
Self::Select(v) => write!(f, "({v})"),
|
||||
Self::Create(v) => write!(f, "({v})"),
|
||||
Self::Update(v) => write!(f, "({v})"),
|
||||
Self::Delete(v) => write!(f, "({v})"),
|
||||
Self::Relate(v) => write!(f, "({v})"),
|
||||
Self::Insert(v) => write!(f, "({v})"),
|
||||
Self::Ifelse(v) => Display::fmt(v, f),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1294,27 +1294,27 @@ impl fmt::Display for Value {
|
|||
Value::Null => write!(f, "NULL"),
|
||||
Value::True => write!(f, "true"),
|
||||
Value::False => write!(f, "false"),
|
||||
Value::Number(v) => write!(f, "{}", v),
|
||||
Value::Strand(v) => write!(f, "{}", v),
|
||||
Value::Duration(v) => write!(f, "{}", v),
|
||||
Value::Datetime(v) => write!(f, "{}", v),
|
||||
Value::Uuid(v) => write!(f, "{}", v),
|
||||
Value::Array(v) => write!(f, "{}", v),
|
||||
Value::Object(v) => write!(f, "{}", v),
|
||||
Value::Geometry(v) => write!(f, "{}", v),
|
||||
Value::Param(v) => write!(f, "{}", v),
|
||||
Value::Idiom(v) => write!(f, "{}", v),
|
||||
Value::Table(v) => write!(f, "{}", v),
|
||||
Value::Thing(v) => write!(f, "{}", v),
|
||||
Value::Model(v) => write!(f, "{}", v),
|
||||
Value::Regex(v) => write!(f, "{}", v),
|
||||
Value::Range(v) => write!(f, "{}", v),
|
||||
Value::Edges(v) => write!(f, "{}", v),
|
||||
Value::Future(v) => write!(f, "{}", v),
|
||||
Value::Constant(v) => write!(f, "{}", v),
|
||||
Value::Function(v) => write!(f, "{}", v),
|
||||
Value::Subquery(v) => write!(f, "{}", v),
|
||||
Value::Expression(v) => write!(f, "{}", v),
|
||||
Value::Number(v) => write!(f, "{v}"),
|
||||
Value::Strand(v) => write!(f, "{v}"),
|
||||
Value::Duration(v) => write!(f, "{v}"),
|
||||
Value::Datetime(v) => write!(f, "{v}"),
|
||||
Value::Uuid(v) => write!(f, "{v}"),
|
||||
Value::Array(v) => write!(f, "{v}"),
|
||||
Value::Object(v) => write!(f, "{v}"),
|
||||
Value::Geometry(v) => write!(f, "{v}"),
|
||||
Value::Param(v) => write!(f, "{v}"),
|
||||
Value::Idiom(v) => write!(f, "{v}"),
|
||||
Value::Table(v) => write!(f, "{v}"),
|
||||
Value::Thing(v) => write!(f, "{v}"),
|
||||
Value::Model(v) => write!(f, "{v}"),
|
||||
Value::Regex(v) => write!(f, "{v}"),
|
||||
Value::Range(v) => write!(f, "{v}"),
|
||||
Value::Edges(v) => write!(f, "{v}"),
|
||||
Value::Future(v) => write!(f, "{v}"),
|
||||
Value::Constant(v) => write!(f, "{v}"),
|
||||
Value::Function(v) => write!(f, "{v}"),
|
||||
Value::Subquery(v) => write!(f, "{v}"),
|
||||
Value::Expression(v) => write!(f, "{v}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ impl fmt::Display for View {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "AS SELECT {} FROM {}", self.expr, self.what)?;
|
||||
if let Some(ref v) = self.cond {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
if let Some(ref v) = self.group {
|
||||
write!(f, " {}", v)?
|
||||
write!(f, " {v}")?
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ impl Rpc {
|
|||
// We've received a message from the client
|
||||
Ok(msg) => match msg {
|
||||
msg if msg.is_ping() => {
|
||||
let _ = chn.send(Message::pong(vec![]));
|
||||
let _ = chn.send(Message::pong(vec![])).await;
|
||||
}
|
||||
msg if msg.is_text() => {
|
||||
tokio::task::spawn(Rpc::call(rpc.clone(), msg, chn.clone()));
|
||||
|
|
Loading…
Reference in a new issue