diff --git a/core/src/iam/signin.rs b/core/src/iam/signin.rs index b7c77d76..566003d3 100644 --- a/core/src/iam/signin.rs +++ b/core/src/iam/signin.rs @@ -2284,7 +2284,7 @@ dn/RsYEONbwQSjIfMPkvxF+8HQ== let key = grant.get("key").unwrap().clone().as_string(); // Remove bearer access method - ds.execute(&format!(r#"REMOVE ACCESS api ON DATABASE;"#), &sess, None).await.unwrap(); + ds.execute("REMOVE ACCESS api ON DATABASE", &sess, None).await.unwrap(); // Signin with the bearer key let mut sess = Session { @@ -2989,7 +2989,7 @@ dn/RsYEONbwQSjIfMPkvxF+8HQ== let key = grant.get("key").unwrap().clone().as_string(); // Remove bearer access method - ds.execute(&format!(r#"REMOVE ACCESS api ON NAMESPACE;"#), &sess, None).await.unwrap(); + ds.execute("REMOVE ACCESS api ON NAMESPACE", &sess, None).await.unwrap(); // Signin with the bearer key let mut sess = Session { @@ -3636,7 +3636,7 @@ dn/RsYEONbwQSjIfMPkvxF+8HQ== let key = grant.get("key").unwrap().clone().as_string(); // Remove bearer access method - ds.execute(&format!(r#"REMOVE ACCESS api ON ROOT;"#), &sess, None).await.unwrap(); + ds.execute("REMOVE ACCESS api ON ROOT", &sess, None).await.unwrap(); // Signin with the bearer key let mut sess = Session { diff --git a/core/src/sql/function.rs b/core/src/sql/function.rs index a483ab43..0d6871c1 100644 --- a/core/src/sql/function.rs +++ b/core/src/sql/function.rs @@ -213,12 +213,12 @@ impl Function { } Self::Anonymous(v, x) => { let val = match v { - c @ Value::Closure(_) => c, - Value::Param(p) => ctx.value(p).unwrap_or(&Value::None), + c @ Value::Closure(_) => c.clone(), + Value::Param(p) => ctx.value(p).cloned().unwrap_or(Value::None), Value::Block(_) | Value::Subquery(_) | Value::Idiom(_) | Value::Function(_) => { - &stk.run(|stk| v.compute(stk, ctx, opt, doc)).await? + stk.run(|stk| v.compute(stk, ctx, opt, doc)).await? } - _ => &Value::None, + _ => Value::None, }; match val { diff --git a/lib/tests/access.rs b/lib/tests/access.rs index 45c8df5f..496cee27 100644 --- a/lib/tests/access.rs +++ b/lib/tests/access.rs @@ -8,7 +8,7 @@ use surrealdb::iam::Role; use surrealdb::sql::Value; #[tokio::test] -async fn access_bearer_database() -> () { +async fn access_bearer_database() { // TODO(gguillemas): Remove this once bearer access is no longer experimental. std::env::set_var("SURREAL_EXPERIMENTAL_BEARER_ACCESS", "true"); @@ -321,7 +321,7 @@ async fn access_bearer_root() { } #[tokio::test] -async fn access_bearer_revoke_db() -> () { +async fn access_bearer_revoke_db() { // TODO(gguillemas): Remove this once bearer access is no longer experimental. std::env::set_var("SURREAL_EXPERIMENTAL_BEARER_ACCESS", "true"); @@ -355,7 +355,7 @@ async fn access_bearer_revoke_db() -> () { } #[tokio::test] -async fn access_bearer_revoke_ns() -> () { +async fn access_bearer_revoke_ns() { // TODO(gguillemas): Remove this once bearer access is no longer experimental. std::env::set_var("SURREAL_EXPERIMENTAL_BEARER_ACCESS", "true"); @@ -389,7 +389,7 @@ async fn access_bearer_revoke_ns() -> () { } #[tokio::test] -async fn access_bearer_revoke_root() -> () { +async fn access_bearer_revoke_root() { // TODO(gguillemas): Remove this once bearer access is no longer experimental. std::env::set_var("SURREAL_EXPERIMENTAL_BEARER_ACCESS", "true"); @@ -469,7 +469,7 @@ async fn permissions_access_grant_db() { { let ds = new_ds().await.unwrap().with_auth_enabled(true); - let mut resp = ds.execute(&statement_setup, &sess_setup, None).await.unwrap(); + let mut resp = ds.execute(statement_setup, &sess_setup, None).await.unwrap(); let res = resp.remove(0).output(); assert!(res.is_ok(), "Error setting up access method: {:?}", res); let res = resp.remove(0).output(); @@ -536,7 +536,7 @@ async fn permissions_access_grant_ns() { { let ds = new_ds().await.unwrap().with_auth_enabled(true); - let mut resp = ds.execute(&statement_setup, &sess_setup, None).await.unwrap(); + let mut resp = ds.execute(statement_setup, &sess_setup, None).await.unwrap(); let res = resp.remove(0).output(); assert!(res.is_ok(), "Error setting up access method: {:?}", res); let res = resp.remove(0).output(); @@ -603,7 +603,7 @@ async fn permissions_access_grant_root() { { let ds = new_ds().await.unwrap().with_auth_enabled(true); - let mut resp = ds.execute(&statement_setup, &sess_setup, None).await.unwrap(); + let mut resp = ds.execute(statement_setup, &sess_setup, None).await.unwrap(); let res = resp.remove(0).output(); assert!(res.is_ok(), "Error setting up access method: {:?}", res); let res = resp.remove(0).output(); diff --git a/lib/tests/fetch.rs b/lib/tests/fetch.rs index 6b126815..53db4545 100644 --- a/lib/tests/fetch.rs +++ b/lib/tests/fetch.rs @@ -338,8 +338,8 @@ async fn create_relate_select() -> Result<(), Error> { res.remove(0); match res.remove(0).result { Err(Error::InvalidFetch { - value: Value::Number(Number::Float(1.0)), - }) => {} + value, + }) if value == Value::Number(Number::Float(1.0)) => {} found => panic!("Expected Err(Error::InvalidFetch), found '{found:?}'"), }; assert_eq!(tmp, val);