From b1d946a91c0750e8d5782895960ded9d147b6fb8 Mon Sep 17 00:00:00 2001 From: David Marshall Date: Sat, 22 Feb 2025 10:55:04 -0600 Subject: [PATCH 1/5] fix clippy warnings for operator precedence and cfg(wasm_bindgen_unstable_test_coverage) --- bindings/wasm/Cargo.toml | 7 +++++-- src/builtins/uuid.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index 0ac7c0e3..2a14c252 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -17,8 +17,11 @@ coverage = ["regorus/coverage"] [dependencies] regorus = { path = "../..", default-features = false, features = ["arc"] } -serde_json = "1.0.111" -wasm-bindgen = "=0.2.93" +serde_json = "1.0.139" +wasm-bindgen = "=0.2.100" [dev-dependencies] wasm-bindgen-test = "0.3.40" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] } diff --git a/src/builtins/uuid.rs b/src/builtins/uuid.rs index 8fb8aed5..6e653b54 100644 --- a/src/builtins/uuid.rs +++ b/src/builtins/uuid.rs @@ -132,13 +132,13 @@ fn timestamp(uuid: &Uuid) -> Option { const fn decode_rfc4122_timestamp(uuid: &Uuid) -> (u64, u16) { let bytes = uuid.as_bytes(); - let ticks: u64 = ((bytes[6] & 0x0F) as u64) << 56 - | (bytes[7] as u64) << 48 - | (bytes[4] as u64) << 40 - | (bytes[5] as u64) << 32 - | (bytes[0] as u64) << 24 - | (bytes[1] as u64) << 16 - | (bytes[2] as u64) << 8 + let ticks: u64 = (((bytes[6] & 0x0F) as u64) << 56) + | ((bytes[7] as u64) << 48) + | ((bytes[4] as u64) << 40) + | ((bytes[5] as u64) << 32) + | ((bytes[0] as u64) << 24) + | ((bytes[1] as u64) << 16) + | ((bytes[2] as u64) << 8) | (bytes[3] as u64); let counter: u16 = ((bytes[8] & 0x3F) as u16) << 8 | (bytes[9] as u16); From 02c871d5c56c3076c4fd7c807136784e5752a9d0 Mon Sep 17 00:00:00 2001 From: David Marshall Date: Sat, 22 Feb 2025 11:03:11 -0600 Subject: [PATCH 2/5] one more () for clippy --- src/builtins/uuid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtins/uuid.rs b/src/builtins/uuid.rs index 6e653b54..e10ea7b9 100644 --- a/src/builtins/uuid.rs +++ b/src/builtins/uuid.rs @@ -141,7 +141,7 @@ const fn decode_rfc4122_timestamp(uuid: &Uuid) -> (u64, u16) { | ((bytes[2] as u64) << 8) | (bytes[3] as u64); - let counter: u16 = ((bytes[8] & 0x3F) as u16) << 8 | (bytes[9] as u16); + let counter: u16 = (((bytes[8] & 0x3F) as u16) << 8) | (bytes[9] as u16); (ticks, counter) } From 3ba36bb394a64d208f63d75cba70e65e1612f15d Mon Sep 17 00:00:00 2001 From: David Marshall Date: Sat, 22 Feb 2025 11:27:15 -0600 Subject: [PATCH 3/5] fix getrandom dep for wasm_js --- bindings/wasm/.cargo/config.toml | 3 +++ bindings/wasm/Cargo.toml | 2 ++ build.rs | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 bindings/wasm/.cargo/config.toml diff --git a/bindings/wasm/.cargo/config.toml b/bindings/wasm/.cargo/config.toml new file mode 100644 index 00000000..bc75a9b1 --- /dev/null +++ b/bindings/wasm/.cargo/config.toml @@ -0,0 +1,3 @@ +[build] +rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""] + diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index 2a14c252..5ddc75b2 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -16,8 +16,10 @@ ast = ["regorus/ast"] coverage = ["regorus/coverage"] [dependencies] +getrandom = { version = "0.3", features = ["wasm_js"] } regorus = { path = "../..", default-features = false, features = ["arc"] } serde_json = "1.0.139" +uuid = { version = "1.14", features = ["rng-getrandom"] } wasm-bindgen = "=0.2.100" [dev-dependencies] diff --git a/build.rs b/build.rs index 42cf34d5..8c93911f 100644 --- a/build.rs +++ b/build.rs @@ -26,5 +26,8 @@ fn main() -> Result<()> { println!("cargo:rustc-env=GIT_HASH={}", git_hash); } + // Add this line to force WebAssembly to use the correct random backend + println!("cargo:rustc-cfg=getrandom_backend=\"wasm_js\""); + Ok(()) } From 2fb1c955c9b3c5c34b96d97e562c6f499f9cb026 Mon Sep 17 00:00:00 2001 From: David Marshall Date: Sat, 22 Feb 2025 11:41:56 -0600 Subject: [PATCH 4/5] bump jsonschema --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7971d1ba..77c7c727 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -120,7 +120,7 @@ semver = {version = "1.0.20", optional = true, default-features = false } wax = { version = "0.6.0", features = [], default-features = false, optional = true } url = { version = "2.5.0", optional = true } uuid = { version = "1.6.1", default-features = false, features = ["v4", "fast-rng"], optional = true } -jsonschema = { version = "0.28.1", default-features = false, optional = true } +jsonschema = { version = "0.29.0", default-features = false, optional = true } chrono = { version = "0.4.31", optional = true } chrono-tz = { version = "0.10.0", optional = true } jsonwebtoken = { version = "9.2.0", optional = true } From c5d3eea3912215246a00123eebe76f77ebc3c905 Mon Sep 17 00:00:00 2001 From: David Marshall Date: Sat, 22 Feb 2025 11:45:49 -0600 Subject: [PATCH 5/5] remove rustc-cfg=getrandom_backend=wasm_js from top level build.rs --- build.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.rs b/build.rs index 8c93911f..42cf34d5 100644 --- a/build.rs +++ b/build.rs @@ -26,8 +26,5 @@ fn main() -> Result<()> { println!("cargo:rustc-env=GIT_HASH={}", git_hash); } - // Add this line to force WebAssembly to use the correct random backend - println!("cargo:rustc-cfg=getrandom_backend=\"wasm_js\""); - Ok(()) }