diff --git a/lib/src/dbs/statement.rs b/lib/src/dbs/statement.rs index 59112316..622b00f4 100644 --- a/lib/src/dbs/statement.rs +++ b/lib/src/dbs/statement.rs @@ -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}"), } } } diff --git a/lib/src/fnc/crypto.rs b/lib/src/fnc/crypto.rs index a554eec6..d411bebd 100644 --- a/lib/src/fnc/crypto.rs +++ b/lib/src/fnc/crypto.rs @@ -10,7 +10,7 @@ pub fn md5((arg,): (String,)) -> Result { 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 { 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 { 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 { 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()) } diff --git a/lib/src/fnc/rand.rs b/lib/src/fnc/rand.rs index ddbcb340..77aa1e46 100644 --- a/lib/src/fnc/rand.rs +++ b/lib/src/fnc/rand.rs @@ -52,12 +52,12 @@ pub fn guid((arg1, arg2): (Option, Option)) -> Result { 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, Option)) -> Result { } 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, Option)) -> Result 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, Option)) -> Result } 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 { 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 { diff --git a/lib/src/fnc/script/error.rs b/lib/src/fnc/script/error.rs index 8c208e84..2a04bf3b 100644 --- a/lib/src/fnc/script/error.rs +++ b/lib/src/fnc/script/error.rs @@ -12,7 +12,7 @@ impl From 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 for Error { true => String::default(), }, match stack.is_empty() { - false => format!("\n{}", stack), + false => format!("\n{stack}"), true => String::default(), } ), diff --git a/lib/src/fnc/string.rs b/lib/src/fnc/string.rs index 54be9ed1..372e4ba2 100644 --- a/lib/src/fnc/string.rs +++ b/lib/src/fnc/string.rs @@ -36,7 +36,7 @@ pub fn repeat((val, num): (String, usize)) -> Result { 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()) diff --git a/lib/src/kvs/tx.rs b/lib/src/kvs/tx.rs index 4b62f385..ee88704a 100644 --- a/lib/src/kvs/tx.rs +++ b/lib/src/kvs/tx.rs @@ -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?; } } diff --git a/lib/src/sql/base.rs b/lib/src/sql/base.rs index d16fad0c..48890173 100644 --- a/lib/src/sql/base.rs +++ b/lib/src/sql/base.rs @@ -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"), } } diff --git a/lib/src/sql/data.rs b/lib/src/sql/data.rs index 51853100..36c352e0 100644 --- a/lib/src/sql/data.rs +++ b/lib/src/sql/data.rs @@ -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}",))) + ) ), } } diff --git a/lib/src/sql/escape.rs b/lib/src/sql/escape.rs index ffdd4c88..f38a95be 100644 --- a/lib/src/sql/escape.rs +++ b/lib/src/sql/escape.rs @@ -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), } diff --git a/lib/src/sql/field.rs b/lib/src/sql/field.rs index 837a24c1..fd78d5a5 100644 --- a/lib/src/sql/field.rs +++ b/lib/src/sql/field.rs @@ -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}"), } } } diff --git a/lib/src/sql/function.rs b/lib/src/sql/function.rs index d6ed2bbe..f05f6339 100644 --- a/lib/src/sql/function.rs +++ b/lib/src/sql/function.rs @@ -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)), } } } diff --git a/lib/src/sql/graph.rs b/lib/src/sql/graph.rs index 9ed02221..ed5de6f6 100644 --- a/lib/src/sql/graph.rs +++ b/lib/src/sql/graph.rs @@ -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(')') } diff --git a/lib/src/sql/idiom.rs b/lib/src/sql/idiom.rs index dbbb02e6..b3d6220b 100644 --- a/lib/src/sql/idiom.rs +++ b/lib/src/sql/idiom.rs @@ -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 { diff --git a/lib/src/sql/number.rs b/lib/src/sql/number.rs index 4ddb115d..d62cc0c5 100644 --- a/lib/src/sql/number.rs +++ b/lib/src/sql/number.rs @@ -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(), } } diff --git a/lib/src/sql/part.rs b/lib/src/sql/part.rs index 6850785e..3846d667 100644 --- a/lib/src/sql/part.rs +++ b/lib/src/sql/part.rs @@ -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}"), } } } diff --git a/lib/src/sql/permission.rs b/lib/src/sql/permission.rs index 7300f580..b48e1815 100644 --- a/lib/src/sql/permission.rs +++ b/lib/src/sql/permission.rs @@ -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}"), } } } diff --git a/lib/src/sql/range.rs b/lib/src/sql/range.rs index 07bea1f6..5c29fc25 100644 --- a/lib/src/sql/range.rs +++ b/lib/src/sql/range.rs @@ -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(()) } diff --git a/lib/src/sql/statement.rs b/lib/src/sql/statement.rs index 83e8238e..f06f3f19 100644 --- a/lib/src/sql/statement.rs +++ b/lib/src/sql/statement.rs @@ -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}"), } } } diff --git a/lib/src/sql/statements/create.rs b/lib/src/sql/statements/create.rs index e14cbdf1..262cbcaf 100644 --- a/lib/src/sql/statements/create.rs +++ b/lib/src/sql/statements/create.rs @@ -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")? diff --git a/lib/src/sql/statements/define.rs b/lib/src/sql/statements/define.rs index 267289ab..ccca9148 100644 --- a/lib/src/sql/statements/define.rs +++ b/lib/src/sql/statements/define.rs @@ -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)?; diff --git a/lib/src/sql/statements/delete.rs b/lib/src/sql/statements/delete.rs index e4f692a4..f2af53f2 100644 --- a/lib/src/sql/statements/delete.rs +++ b/lib/src/sql/statements/delete.rs @@ -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")? diff --git a/lib/src/sql/statements/ifelse.rs b/lib/src/sql/statements/ifelse.rs index 3029af65..cca0723f 100644 --- a/lib/src/sql/statements/ifelse.rs +++ b/lib/src/sql/statements/ifelse.rs @@ -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(()) diff --git a/lib/src/sql/statements/info.rs b/lib/src/sql/statements/info.rs index 3f70d662..0a27c463 100644 --- a/lib/src/sql/statements/info.rs +++ b/lib/src/sql/statements/info.rs @@ -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}"), } } } diff --git a/lib/src/sql/statements/insert.rs b/lib/src/sql/statements/insert.rs index aa85e2e2..da86cc81 100644 --- a/lib/src/sql/statements/insert.rs +++ b/lib/src/sql/statements/insert.rs @@ -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")? diff --git a/lib/src/sql/statements/live.rs b/lib/src/sql/statements/live.rs index 02ab0e6f..b0fc3d65 100644 --- a/lib/src/sql/statements/live.rs +++ b/lib/src/sql/statements/live.rs @@ -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(()) } diff --git a/lib/src/sql/statements/output.rs b/lib/src/sql/statements/output.rs index 28c7679e..c0db7866 100644 --- a/lib/src/sql/statements/output.rs +++ b/lib/src/sql/statements/output.rs @@ -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(()) } diff --git a/lib/src/sql/statements/relate.rs b/lib/src/sql/statements/relate.rs index 2e4a0223..292465c6 100644 --- a/lib/src/sql/statements/relate.rs +++ b/lib/src/sql/statements/relate.rs @@ -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")? diff --git a/lib/src/sql/statements/select.rs b/lib/src/sql/statements/select.rs index 3c34d5b0..f3cc17c6 100644 --- a/lib/src/sql/statements/select.rs +++ b/lib/src/sql/statements/select.rs @@ -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")? diff --git a/lib/src/sql/statements/update.rs b/lib/src/sql/statements/update.rs index e5efab96..936daad4 100644 --- a/lib/src/sql/statements/update.rs +++ b/lib/src/sql/statements/update.rs @@ -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")? diff --git a/lib/src/sql/statements/yuse.rs b/lib/src/sql/statements/yuse.rs index 99a7c3d8..5c562fa6 100644 --- a/lib/src/sql/statements/yuse.rs +++ b/lib/src/sql/statements/yuse.rs @@ -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(()) } diff --git a/lib/src/sql/subquery.rs b/lib/src/sql/subquery.rs index cb50b42d..431a3503 100644 --- a/lib/src/sql/subquery.rs +++ b/lib/src/sql/subquery.rs @@ -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), } } diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index b00e2ed1..63b5e56e 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -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}"), } } } diff --git a/lib/src/sql/view.rs b/lib/src/sql/view.rs index 3590fdce..538fe8cd 100644 --- a/lib/src/sql/view.rs +++ b/lib/src/sql/view.rs @@ -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(()) } diff --git a/src/net/rpc.rs b/src/net/rpc.rs index b1ecf44e..eb814976 100644 --- a/src/net/rpc.rs +++ b/src/net/rpc.rs @@ -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()));