Fix clippy lint warnings

This commit is contained in:
Tobie Morgan Hitchcock 2022-11-23 09:09:24 +00:00
parent d4f1c28a4a
commit 4b14837009
4 changed files with 10 additions and 10 deletions
lib/src
fnc
sql/value
src/iam

View file

@ -62,7 +62,7 @@ pub fn sort((array, order): (Value, Option<Value>)) -> Result<Value, Error> {
Value::Array(mut v) => match order {
// If "asc", sort ascending
Some(Value::Strand(s)) if s.as_str() == "asc" => {
v.sort_unstable_by(|a, b| a.cmp(b));
v.sort_unstable();
Ok(v.into())
}
// If "desc", sort descending
@ -72,7 +72,7 @@ pub fn sort((array, order): (Value, Option<Value>)) -> Result<Value, Error> {
}
// If true, sort ascending
Some(Value::True) => {
v.sort_unstable_by(|a, b| a.cmp(b));
v.sort_unstable();
Ok(v.into())
}
// If false, sort descending
@ -82,7 +82,7 @@ pub fn sort((array, order): (Value, Option<Value>)) -> Result<Value, Error> {
}
// Sort ascending by default
_ => {
v.sort_unstable_by(|a, b| a.cmp(b));
v.sort_unstable();
Ok(v.into())
}
},
@ -105,7 +105,7 @@ pub mod sort {
pub fn asc((array,): (Value,)) -> Result<Value, Error> {
match array {
Value::Array(mut v) => {
v.sort_unstable_by(|a, b| a.cmp(b));
v.sort_unstable();
Ok(v.into())
}
v => Ok(v),

View file

@ -1147,11 +1147,11 @@ impl Value {
Value::Array(v) => v.iter().any(|v| v.equal(other)),
Value::Thing(v) => match other {
Value::Strand(w) => v.to_string().contains(w.as_str()),
_ => v.to_string().contains(&other.to_string().as_str()),
_ => v.to_string().contains(other.to_string().as_str()),
},
Value::Strand(v) => match other {
Value::Strand(w) => v.contains(w.as_str()),
_ => v.contains(&other.to_string().as_str()),
_ => v.contains(other.to_string().as_str()),
},
Value::Geometry(v) => match other {
Value::Geometry(w) => v.contains(w),

View file

@ -141,7 +141,7 @@ pub async fn sc(
..Claims::default()
};
// Create the authentication token
let enc = encode(&*HEADER, &val, &key);
let enc = encode(&HEADER, &val, &key);
// Set the authentication on the session
session.tk = Some(val.into());
session.ns = Some(ns.to_owned());
@ -206,7 +206,7 @@ pub async fn db(
..Claims::default()
};
// Create the authentication token
let enc = encode(&*HEADER, &val, &key);
let enc = encode(&HEADER, &val, &key);
// Set the authentication on the session
session.tk = Some(val.into());
session.ns = Some(ns.to_owned());
@ -260,7 +260,7 @@ pub async fn ns(
..Claims::default()
};
// Create the authentication token
let enc = encode(&*HEADER, &val, &key);
let enc = encode(&HEADER, &val, &key);
// Set the authentication on the session
session.tk = Some(val.into());
session.ns = Some(ns.to_owned());

View file

@ -82,7 +82,7 @@ pub async fn sc(
..Claims::default()
};
// Create the authentication token
let enc = encode(&*HEADER, &val, &key);
let enc = encode(&HEADER, &val, &key);
// Set the authentication on the session
session.tk = Some(val.into());
session.ns = Some(ns.to_owned());