From 9b9b678a40fcec2db1563df022071f8a14066c7f Mon Sep 17 00:00:00 2001 From: Noa Date: Tue, 19 Nov 2024 12:37:14 -0600 Subject: [PATCH 1/5] Bump to Rust 1.83 --- .github/workflows/benchmarks.yml | 2 +- Cargo.toml | 2 +- crates/bench/Dockerfile | 2 +- crates/standalone/Dockerfile | 2 +- rust-toolchain.toml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 4ea8e367611..32e9eea3025 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -183,7 +183,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 # on a successful run, runs in 8 minutes container: - image: rust:1.78 + image: rust:1.83.0 options: --privileged # filter for a comment containing 'benchmarks please' if: ${{ github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, 'benchmarks please')) }} diff --git a/Cargo.toml b/Cargo.toml index 5c1628078e8..55ec0cd328a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,7 +88,7 @@ debug = true version = "1.0.0-rc4" edition = "2021" # update rust-toolchain.toml too! -rust-version = "1.78.0" +rust-version = "1.83.0" [workspace.dependencies] spacetimedb = { path = "crates/bindings", version = "1.0.0-rc4" } diff --git a/crates/bench/Dockerfile b/crates/bench/Dockerfile index 1c47c183ea1..7b193b5f054 100644 --- a/crates/bench/Dockerfile +++ b/crates/bench/Dockerfile @@ -3,7 +3,7 @@ # See the README for commands to run. # sync with: ../../rust-toolchain.toml -FROM rust:1.77.0 +FROM rust:1.83.0 RUN apt-get update && \ apt-get install -y valgrind bash && \ diff --git a/crates/standalone/Dockerfile b/crates/standalone/Dockerfile index 4c6228a53f9..18be50ba4f5 100644 --- a/crates/standalone/Dockerfile +++ b/crates/standalone/Dockerfile @@ -1,7 +1,7 @@ ARG CARGO_PROFILE=release -FROM rust:1.78.0 AS chef +FROM rust:1.83.0 AS chef RUN rust_target=$(rustc -vV | awk '/^host:/{ print $2 }') && \ curl https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$rust_target.tgz -fL | tar xz -C $CARGO_HOME/bin RUN cargo binstall -y cargo-chef@0.1.56 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ca36fdc2ef8..80ea4078b0e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,6 @@ [toolchain] -# change crates/standalone/Dockerfile and rust-version in Cargo.toml too! +# change crates/{standalone,bench}/Dockerfile and rust-version in Cargo.toml too! # also the docker image tag in .github/workflows/benchmarks.yml:jobs/callgrind_benchmark/container/image -channel = "1.78.0" +channel = "1.83.0" profile = "default" targets = ["wasm32-unknown-unknown"] From 5550a3365e34230f140f28ee67cab05c6526a9a8 Mon Sep 17 00:00:00 2001 From: Noa Date: Tue, 19 Nov 2024 12:51:41 -0600 Subject: [PATCH 2/5] Update code/fix warnings for Rust 1.83 --- Cargo.lock | 8 +- Cargo.toml | 2 +- crates/bindings-macro/src/table.rs | 2 +- crates/bindings-sys/src/lib.rs | 2 + crates/bindings/src/logger.rs | 2 +- crates/cli/src/config.rs | 18 +-- crates/cli/src/errors.rs | 2 +- crates/cli/src/subcommands/generate/rust.rs | 4 +- crates/cli/src/tasks/rust.rs | 2 +- .../snapshots/codegen__codegen_rust.snap | 115 ++++++++++++------ crates/client-api-messages/src/name/tests.rs | 1 - crates/client-api/src/util/flat_csv.rs | 1 + crates/commitlog/src/index/indexfile.rs | 2 +- crates/commitlog/src/lib.rs | 3 +- crates/core/Cargo.toml | 2 + crates/core/src/callgrind_flag.rs | 1 - .../locking_tx_datastore/committed_state.rs | 5 +- .../locking_tx_datastore/datastore.rs | 5 +- .../datastore/locking_tx_datastore/mut_tx.rs | 19 ++- .../db/datastore/locking_tx_datastore/tx.rs | 3 +- crates/core/src/db/datastore/traits.rs | 24 ++-- crates/core/src/host/module_host.rs | 4 - .../src/host/wasm_common/module_host_actor.rs | 4 +- .../src/host/wasmtime/wasm_instance_env.rs | 7 +- .../core/src/host/wasmtime/wasmtime_module.rs | 3 +- crates/core/src/subscription/tx.rs | 2 +- crates/core/src/util/mod.rs | 9 +- crates/core/src/vm.rs | 6 +- crates/lib/src/db/default_element_ordering.rs | 20 +-- crates/lib/src/db/raw_def/v9.rs | 2 +- crates/lib/src/identity.rs | 6 +- crates/lib/src/lib.rs | 14 --- crates/paths/src/cli.rs | 5 +- crates/paths/src/lib.rs | 3 +- crates/paths/src/utils.rs | 7 +- crates/physical-plan/src/plan.rs | 18 ++- crates/sats/src/bsatn/de.rs | 10 +- crates/sats/src/buffer.rs | 6 +- crates/sats/src/hex.rs | 4 +- crates/sats/src/lib.rs | 2 +- crates/sats/src/satn.rs | 86 ++++++------- crates/schema/src/auto_migrate.rs | 6 +- .../src/module_bindings/connected_table.rs | 2 +- .../src/module_bindings/connected_type.rs | 2 +- .../src/module_bindings/disconnected_table.rs | 2 +- .../src/module_bindings/disconnected_type.rs | 2 +- .../identity_connected_reducer.rs | 2 +- .../identity_disconnected_reducer.rs | 2 +- .../src/module_bindings/mod.rs | 2 +- .../src/module_bindings/byte_struct_type.rs | 2 +- .../delete_pk_address_reducer.rs | 2 +- .../module_bindings/delete_pk_bool_reducer.rs | 2 +- .../delete_pk_i_128_reducer.rs | 2 +- .../module_bindings/delete_pk_i_16_reducer.rs | 2 +- .../delete_pk_i_256_reducer.rs | 2 +- .../module_bindings/delete_pk_i_32_reducer.rs | 2 +- .../module_bindings/delete_pk_i_64_reducer.rs | 2 +- .../module_bindings/delete_pk_i_8_reducer.rs | 2 +- .../delete_pk_identity_reducer.rs | 2 +- .../delete_pk_string_reducer.rs | 2 +- .../delete_pk_u_128_reducer.rs | 2 +- .../module_bindings/delete_pk_u_16_reducer.rs | 2 +- .../delete_pk_u_256_reducer.rs | 2 +- .../module_bindings/delete_pk_u_32_reducer.rs | 2 +- .../module_bindings/delete_pk_u_64_reducer.rs | 2 +- .../module_bindings/delete_pk_u_8_reducer.rs | 2 +- .../delete_unique_address_reducer.rs | 2 +- .../delete_unique_bool_reducer.rs | 2 +- .../delete_unique_i_128_reducer.rs | 2 +- .../delete_unique_i_16_reducer.rs | 2 +- .../delete_unique_i_256_reducer.rs | 2 +- .../delete_unique_i_32_reducer.rs | 2 +- .../delete_unique_i_64_reducer.rs | 2 +- .../delete_unique_i_8_reducer.rs | 2 +- .../delete_unique_identity_reducer.rs | 2 +- .../delete_unique_string_reducer.rs | 2 +- .../delete_unique_u_128_reducer.rs | 2 +- .../delete_unique_u_16_reducer.rs | 2 +- .../delete_unique_u_256_reducer.rs | 2 +- .../delete_unique_u_32_reducer.rs | 2 +- .../delete_unique_u_64_reducer.rs | 2 +- .../delete_unique_u_8_reducer.rs | 2 +- .../module_bindings/enum_with_payload_type.rs | 2 +- .../every_primitive_struct_type.rs | 2 +- .../module_bindings/every_vec_struct_type.rs | 2 +- .../insert_caller_one_address_reducer.rs | 2 +- .../insert_caller_one_identity_reducer.rs | 2 +- .../insert_caller_pk_address_reducer.rs | 2 +- .../insert_caller_pk_identity_reducer.rs | 2 +- .../insert_caller_unique_address_reducer.rs | 2 +- .../insert_caller_unique_identity_reducer.rs | 2 +- .../insert_caller_vec_address_reducer.rs | 2 +- .../insert_caller_vec_identity_reducer.rs | 2 +- .../insert_large_table_reducer.rs | 2 +- .../insert_one_address_reducer.rs | 2 +- .../insert_one_bool_reducer.rs | 2 +- .../insert_one_byte_struct_reducer.rs | 2 +- .../insert_one_enum_with_payload_reducer.rs | 2 +- ...sert_one_every_primitive_struct_reducer.rs | 2 +- .../insert_one_every_vec_struct_reducer.rs | 2 +- .../insert_one_f_32_reducer.rs | 2 +- .../insert_one_f_64_reducer.rs | 2 +- .../insert_one_i_128_reducer.rs | 2 +- .../insert_one_i_16_reducer.rs | 2 +- .../insert_one_i_256_reducer.rs | 2 +- .../insert_one_i_32_reducer.rs | 2 +- .../insert_one_i_64_reducer.rs | 2 +- .../module_bindings/insert_one_i_8_reducer.rs | 2 +- .../insert_one_identity_reducer.rs | 2 +- .../insert_one_simple_enum_reducer.rs | 2 +- .../insert_one_string_reducer.rs | 2 +- .../insert_one_u_128_reducer.rs | 2 +- .../insert_one_u_16_reducer.rs | 2 +- .../insert_one_u_256_reducer.rs | 2 +- .../insert_one_u_32_reducer.rs | 2 +- .../insert_one_u_64_reducer.rs | 2 +- .../module_bindings/insert_one_u_8_reducer.rs | 2 +- .../insert_one_unit_struct_reducer.rs | 2 +- ...t_option_every_primitive_struct_reducer.rs | 2 +- .../insert_option_i_32_reducer.rs | 2 +- .../insert_option_identity_reducer.rs | 2 +- .../insert_option_simple_enum_reducer.rs | 2 +- .../insert_option_string_reducer.rs | 2 +- .../insert_option_vec_option_i_32_reducer.rs | 2 +- .../insert_pk_address_reducer.rs | 2 +- .../module_bindings/insert_pk_bool_reducer.rs | 2 +- .../insert_pk_i_128_reducer.rs | 2 +- .../module_bindings/insert_pk_i_16_reducer.rs | 2 +- .../insert_pk_i_256_reducer.rs | 2 +- .../module_bindings/insert_pk_i_32_reducer.rs | 2 +- .../module_bindings/insert_pk_i_64_reducer.rs | 2 +- .../module_bindings/insert_pk_i_8_reducer.rs | 2 +- .../insert_pk_identity_reducer.rs | 2 +- .../insert_pk_string_reducer.rs | 2 +- .../insert_pk_u_128_reducer.rs | 2 +- .../module_bindings/insert_pk_u_16_reducer.rs | 2 +- .../insert_pk_u_256_reducer.rs | 2 +- .../module_bindings/insert_pk_u_32_reducer.rs | 2 +- .../module_bindings/insert_pk_u_64_reducer.rs | 2 +- .../module_bindings/insert_pk_u_8_reducer.rs | 2 +- .../insert_primitives_as_strings_reducer.rs | 2 +- .../insert_table_holds_table_reducer.rs | 2 +- .../insert_unique_address_reducer.rs | 2 +- .../insert_unique_bool_reducer.rs | 2 +- .../insert_unique_i_128_reducer.rs | 2 +- .../insert_unique_i_16_reducer.rs | 2 +- .../insert_unique_i_256_reducer.rs | 2 +- .../insert_unique_i_32_reducer.rs | 2 +- .../insert_unique_i_64_reducer.rs | 2 +- .../insert_unique_i_8_reducer.rs | 2 +- .../insert_unique_identity_reducer.rs | 2 +- .../insert_unique_string_reducer.rs | 2 +- .../insert_unique_u_128_reducer.rs | 2 +- .../insert_unique_u_16_reducer.rs | 2 +- .../insert_unique_u_256_reducer.rs | 2 +- .../insert_unique_u_32_reducer.rs | 2 +- .../insert_unique_u_64_reducer.rs | 2 +- .../insert_unique_u_8_reducer.rs | 2 +- .../insert_vec_address_reducer.rs | 2 +- .../insert_vec_bool_reducer.rs | 2 +- .../insert_vec_byte_struct_reducer.rs | 2 +- .../insert_vec_enum_with_payload_reducer.rs | 2 +- ...sert_vec_every_primitive_struct_reducer.rs | 2 +- .../insert_vec_every_vec_struct_reducer.rs | 2 +- .../insert_vec_f_32_reducer.rs | 2 +- .../insert_vec_f_64_reducer.rs | 2 +- .../insert_vec_i_128_reducer.rs | 2 +- .../insert_vec_i_16_reducer.rs | 2 +- .../insert_vec_i_256_reducer.rs | 2 +- .../insert_vec_i_32_reducer.rs | 2 +- .../insert_vec_i_64_reducer.rs | 2 +- .../module_bindings/insert_vec_i_8_reducer.rs | 2 +- .../insert_vec_identity_reducer.rs | 2 +- .../insert_vec_simple_enum_reducer.rs | 2 +- .../insert_vec_string_reducer.rs | 2 +- .../insert_vec_u_128_reducer.rs | 2 +- .../insert_vec_u_16_reducer.rs | 2 +- .../insert_vec_u_256_reducer.rs | 2 +- .../insert_vec_u_32_reducer.rs | 2 +- .../insert_vec_u_64_reducer.rs | 2 +- .../module_bindings/insert_vec_u_8_reducer.rs | 2 +- .../insert_vec_unit_struct_reducer.rs | 2 +- .../src/module_bindings/large_table_table.rs | 2 +- .../src/module_bindings/large_table_type.rs | 2 +- .../test-client/src/module_bindings/mod.rs | 2 +- .../module_bindings/no_op_succeeds_reducer.rs | 2 +- .../src/module_bindings/one_address_table.rs | 2 +- .../src/module_bindings/one_address_type.rs | 2 +- .../src/module_bindings/one_bool_table.rs | 2 +- .../src/module_bindings/one_bool_type.rs | 2 +- .../module_bindings/one_byte_struct_table.rs | 2 +- .../module_bindings/one_byte_struct_type.rs | 2 +- .../one_enum_with_payload_table.rs | 2 +- .../one_enum_with_payload_type.rs | 2 +- .../one_every_primitive_struct_table.rs | 2 +- .../one_every_primitive_struct_type.rs | 2 +- .../one_every_vec_struct_table.rs | 2 +- .../one_every_vec_struct_type.rs | 2 +- .../src/module_bindings/one_f_32_table.rs | 2 +- .../src/module_bindings/one_f_32_type.rs | 2 +- .../src/module_bindings/one_f_64_table.rs | 2 +- .../src/module_bindings/one_f_64_type.rs | 2 +- .../src/module_bindings/one_i_128_table.rs | 2 +- .../src/module_bindings/one_i_128_type.rs | 2 +- .../src/module_bindings/one_i_16_table.rs | 2 +- .../src/module_bindings/one_i_16_type.rs | 2 +- .../src/module_bindings/one_i_256_table.rs | 2 +- .../src/module_bindings/one_i_256_type.rs | 2 +- .../src/module_bindings/one_i_32_table.rs | 2 +- .../src/module_bindings/one_i_32_type.rs | 2 +- .../src/module_bindings/one_i_64_table.rs | 2 +- .../src/module_bindings/one_i_64_type.rs | 2 +- .../src/module_bindings/one_i_8_table.rs | 2 +- .../src/module_bindings/one_i_8_type.rs | 2 +- .../src/module_bindings/one_identity_table.rs | 2 +- .../src/module_bindings/one_identity_type.rs | 2 +- .../module_bindings/one_simple_enum_table.rs | 2 +- .../module_bindings/one_simple_enum_type.rs | 2 +- .../src/module_bindings/one_string_table.rs | 2 +- .../src/module_bindings/one_string_type.rs | 2 +- .../src/module_bindings/one_u_128_table.rs | 2 +- .../src/module_bindings/one_u_128_type.rs | 2 +- .../src/module_bindings/one_u_16_table.rs | 2 +- .../src/module_bindings/one_u_16_type.rs | 2 +- .../src/module_bindings/one_u_256_table.rs | 2 +- .../src/module_bindings/one_u_256_type.rs | 2 +- .../src/module_bindings/one_u_32_table.rs | 2 +- .../src/module_bindings/one_u_32_type.rs | 2 +- .../src/module_bindings/one_u_64_table.rs | 2 +- .../src/module_bindings/one_u_64_type.rs | 2 +- .../src/module_bindings/one_u_8_table.rs | 2 +- .../src/module_bindings/one_u_8_type.rs | 2 +- .../module_bindings/one_unit_struct_table.rs | 2 +- .../module_bindings/one_unit_struct_type.rs | 2 +- .../option_every_primitive_struct_table.rs | 2 +- .../option_every_primitive_struct_type.rs | 2 +- .../src/module_bindings/option_i_32_table.rs | 2 +- .../src/module_bindings/option_i_32_type.rs | 2 +- .../module_bindings/option_identity_table.rs | 2 +- .../module_bindings/option_identity_type.rs | 2 +- .../option_simple_enum_table.rs | 2 +- .../option_simple_enum_type.rs | 2 +- .../module_bindings/option_string_table.rs | 2 +- .../src/module_bindings/option_string_type.rs | 2 +- .../option_vec_option_i_32_table.rs | 2 +- .../option_vec_option_i_32_type.rs | 2 +- .../src/module_bindings/pk_address_table.rs | 2 +- .../src/module_bindings/pk_address_type.rs | 2 +- .../src/module_bindings/pk_bool_table.rs | 2 +- .../src/module_bindings/pk_bool_type.rs | 2 +- .../src/module_bindings/pk_i_128_table.rs | 2 +- .../src/module_bindings/pk_i_128_type.rs | 2 +- .../src/module_bindings/pk_i_16_table.rs | 2 +- .../src/module_bindings/pk_i_16_type.rs | 2 +- .../src/module_bindings/pk_i_256_table.rs | 2 +- .../src/module_bindings/pk_i_256_type.rs | 2 +- .../src/module_bindings/pk_i_32_table.rs | 2 +- .../src/module_bindings/pk_i_32_type.rs | 2 +- .../src/module_bindings/pk_i_64_table.rs | 2 +- .../src/module_bindings/pk_i_64_type.rs | 2 +- .../src/module_bindings/pk_i_8_table.rs | 2 +- .../src/module_bindings/pk_i_8_type.rs | 2 +- .../src/module_bindings/pk_identity_table.rs | 2 +- .../src/module_bindings/pk_identity_type.rs | 2 +- .../src/module_bindings/pk_string_table.rs | 2 +- .../src/module_bindings/pk_string_type.rs | 2 +- .../src/module_bindings/pk_u_128_table.rs | 2 +- .../src/module_bindings/pk_u_128_type.rs | 2 +- .../src/module_bindings/pk_u_16_table.rs | 2 +- .../src/module_bindings/pk_u_16_type.rs | 2 +- .../src/module_bindings/pk_u_256_table.rs | 2 +- .../src/module_bindings/pk_u_256_type.rs | 2 +- .../src/module_bindings/pk_u_32_table.rs | 2 +- .../src/module_bindings/pk_u_32_type.rs | 2 +- .../src/module_bindings/pk_u_64_table.rs | 2 +- .../src/module_bindings/pk_u_64_type.rs | 2 +- .../src/module_bindings/pk_u_8_table.rs | 2 +- .../src/module_bindings/pk_u_8_type.rs | 2 +- .../src/module_bindings/simple_enum_type.rs | 2 +- .../table_holds_table_table.rs | 2 +- .../module_bindings/table_holds_table_type.rs | 2 +- .../module_bindings/unique_address_table.rs | 2 +- .../module_bindings/unique_address_type.rs | 2 +- .../src/module_bindings/unique_bool_table.rs | 2 +- .../src/module_bindings/unique_bool_type.rs | 2 +- .../src/module_bindings/unique_i_128_table.rs | 2 +- .../src/module_bindings/unique_i_128_type.rs | 2 +- .../src/module_bindings/unique_i_16_table.rs | 2 +- .../src/module_bindings/unique_i_16_type.rs | 2 +- .../src/module_bindings/unique_i_256_table.rs | 2 +- .../src/module_bindings/unique_i_256_type.rs | 2 +- .../src/module_bindings/unique_i_32_table.rs | 2 +- .../src/module_bindings/unique_i_32_type.rs | 2 +- .../src/module_bindings/unique_i_64_table.rs | 2 +- .../src/module_bindings/unique_i_64_type.rs | 2 +- .../src/module_bindings/unique_i_8_table.rs | 2 +- .../src/module_bindings/unique_i_8_type.rs | 2 +- .../module_bindings/unique_identity_table.rs | 2 +- .../module_bindings/unique_identity_type.rs | 2 +- .../module_bindings/unique_string_table.rs | 2 +- .../src/module_bindings/unique_string_type.rs | 2 +- .../src/module_bindings/unique_u_128_table.rs | 2 +- .../src/module_bindings/unique_u_128_type.rs | 2 +- .../src/module_bindings/unique_u_16_table.rs | 2 +- .../src/module_bindings/unique_u_16_type.rs | 2 +- .../src/module_bindings/unique_u_256_table.rs | 2 +- .../src/module_bindings/unique_u_256_type.rs | 2 +- .../src/module_bindings/unique_u_32_table.rs | 2 +- .../src/module_bindings/unique_u_32_type.rs | 2 +- .../src/module_bindings/unique_u_64_table.rs | 2 +- .../src/module_bindings/unique_u_64_type.rs | 2 +- .../src/module_bindings/unique_u_8_table.rs | 2 +- .../src/module_bindings/unique_u_8_type.rs | 2 +- .../src/module_bindings/unit_struct_type.rs | 2 +- .../update_pk_address_reducer.rs | 2 +- .../module_bindings/update_pk_bool_reducer.rs | 2 +- .../update_pk_i_128_reducer.rs | 2 +- .../module_bindings/update_pk_i_16_reducer.rs | 2 +- .../update_pk_i_256_reducer.rs | 2 +- .../module_bindings/update_pk_i_32_reducer.rs | 2 +- .../module_bindings/update_pk_i_64_reducer.rs | 2 +- .../module_bindings/update_pk_i_8_reducer.rs | 2 +- .../update_pk_identity_reducer.rs | 2 +- .../update_pk_string_reducer.rs | 2 +- .../update_pk_u_128_reducer.rs | 2 +- .../module_bindings/update_pk_u_16_reducer.rs | 2 +- .../update_pk_u_256_reducer.rs | 2 +- .../module_bindings/update_pk_u_32_reducer.rs | 2 +- .../module_bindings/update_pk_u_64_reducer.rs | 2 +- .../module_bindings/update_pk_u_8_reducer.rs | 2 +- .../update_unique_address_reducer.rs | 2 +- .../update_unique_bool_reducer.rs | 2 +- .../update_unique_i_128_reducer.rs | 2 +- .../update_unique_i_16_reducer.rs | 2 +- .../update_unique_i_256_reducer.rs | 2 +- .../update_unique_i_32_reducer.rs | 2 +- .../update_unique_i_64_reducer.rs | 2 +- .../update_unique_i_8_reducer.rs | 2 +- .../update_unique_identity_reducer.rs | 2 +- .../update_unique_string_reducer.rs | 2 +- .../update_unique_u_128_reducer.rs | 2 +- .../update_unique_u_16_reducer.rs | 2 +- .../update_unique_u_256_reducer.rs | 2 +- .../update_unique_u_32_reducer.rs | 2 +- .../update_unique_u_64_reducer.rs | 2 +- .../update_unique_u_8_reducer.rs | 2 +- .../src/module_bindings/vec_address_table.rs | 2 +- .../src/module_bindings/vec_address_type.rs | 2 +- .../src/module_bindings/vec_bool_table.rs | 2 +- .../src/module_bindings/vec_bool_type.rs | 2 +- .../module_bindings/vec_byte_struct_table.rs | 2 +- .../module_bindings/vec_byte_struct_type.rs | 2 +- .../vec_enum_with_payload_table.rs | 2 +- .../vec_enum_with_payload_type.rs | 2 +- .../vec_every_primitive_struct_table.rs | 2 +- .../vec_every_primitive_struct_type.rs | 2 +- .../vec_every_vec_struct_table.rs | 2 +- .../vec_every_vec_struct_type.rs | 2 +- .../src/module_bindings/vec_f_32_table.rs | 2 +- .../src/module_bindings/vec_f_32_type.rs | 2 +- .../src/module_bindings/vec_f_64_table.rs | 2 +- .../src/module_bindings/vec_f_64_type.rs | 2 +- .../src/module_bindings/vec_i_128_table.rs | 2 +- .../src/module_bindings/vec_i_128_type.rs | 2 +- .../src/module_bindings/vec_i_16_table.rs | 2 +- .../src/module_bindings/vec_i_16_type.rs | 2 +- .../src/module_bindings/vec_i_256_table.rs | 2 +- .../src/module_bindings/vec_i_256_type.rs | 2 +- .../src/module_bindings/vec_i_32_table.rs | 2 +- .../src/module_bindings/vec_i_32_type.rs | 2 +- .../src/module_bindings/vec_i_64_table.rs | 2 +- .../src/module_bindings/vec_i_64_type.rs | 2 +- .../src/module_bindings/vec_i_8_table.rs | 2 +- .../src/module_bindings/vec_i_8_type.rs | 2 +- .../src/module_bindings/vec_identity_table.rs | 2 +- .../src/module_bindings/vec_identity_type.rs | 2 +- .../module_bindings/vec_simple_enum_table.rs | 2 +- .../module_bindings/vec_simple_enum_type.rs | 2 +- .../src/module_bindings/vec_string_table.rs | 2 +- .../src/module_bindings/vec_string_type.rs | 2 +- .../src/module_bindings/vec_u_128_table.rs | 2 +- .../src/module_bindings/vec_u_128_type.rs | 2 +- .../src/module_bindings/vec_u_16_table.rs | 2 +- .../src/module_bindings/vec_u_16_type.rs | 2 +- .../src/module_bindings/vec_u_256_table.rs | 2 +- .../src/module_bindings/vec_u_256_type.rs | 2 +- .../src/module_bindings/vec_u_32_table.rs | 2 +- .../src/module_bindings/vec_u_32_type.rs | 2 +- .../src/module_bindings/vec_u_64_table.rs | 2 +- .../src/module_bindings/vec_u_64_type.rs | 2 +- .../src/module_bindings/vec_u_8_table.rs | 2 +- .../src/module_bindings/vec_u_8_type.rs | 2 +- .../module_bindings/vec_unit_struct_table.rs | 2 +- .../module_bindings/vec_unit_struct_type.rs | 2 +- crates/standalone/Cargo.toml | 1 - crates/standalone/src/subcommands/start.rs | 7 -- crates/table/benches/page.rs | 16 +-- crates/table/src/bflatn_from.rs | 10 +- crates/table/src/eq.rs | 6 +- crates/table/src/eq_to_pv.rs | 6 +- crates/table/src/page.rs | 15 +-- crates/table/src/row_hash.rs | 6 +- crates/table/src/var_len.rs | 18 +-- crates/testing/src/sdk.rs | 2 +- crates/vm/src/rel_ops.rs | 2 +- 405 files changed, 612 insertions(+), 628 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebb7f42c286..40cce4ea5a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -3583,13 +3583,13 @@ dependencies = [ [[package]] name = "proptest-derive" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf16337405ca084e9c78985114633b6827711d22b9e6ef6c6c0d665eb3f0b6e" +checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.87", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 55ec0cd328a..3fa8b8e1b15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -194,7 +194,7 @@ pretty_assertions = { version = "1.4", features = ["unstable"] } proc-macro2 = "1.0" prometheus = "0.13.0" proptest = "1.4" -proptest-derive = "0.4" +proptest-derive = "0.5" quick-junit = { version = "0.3.2" } quote = "1.0.8" rand = "0.8.5" diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs index 21159f6f73b..d3fa472c907 100644 --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -193,7 +193,7 @@ impl IndexArg { Ok(IndexArg { kind, name }) } - fn validate<'a>(&'a self, table_name: &str, cols: &'a [Column<'a>]) -> syn::Result> { + fn validate<'a>(&'a self, table_name: &str, cols: &'a [Column<'a>]) -> syn::Result> { let find_column = |ident| find_column(cols, ident); let kind = match &self.kind { IndexType::BTree { columns } => { diff --git a/crates/bindings-sys/src/lib.rs b/crates/bindings-sys/src/lib.rs index 11e3e7f06f1..6146192deac 100644 --- a/crates/bindings-sys/src/lib.rs +++ b/crates/bindings-sys/src/lib.rs @@ -108,6 +108,7 @@ pub mod raw { /// - `prefix = prefix_ptr[..prefix_len]`, /// - `rstart = rstart_ptr[..rstart_len]`, /// - `rend = rend_ptr[..rend_len]`, + /// /// in WASM memory. /// /// The index itself has a schema/type. @@ -182,6 +183,7 @@ pub mod raw { /// - `prefix = prefix_ptr[..prefix_len]`, /// - `rstart = rstart_ptr[..rstart_len]`, /// - `rend = rend_ptr[..rend_len]`, + /// /// in WASM memory. /// /// This syscall will delete all the rows found by diff --git a/crates/bindings/src/logger.rs b/crates/bindings/src/logger.rs index faf1dadd02b..58416e55981 100644 --- a/crates/bindings/src/logger.rs +++ b/crates/bindings/src/logger.rs @@ -11,7 +11,7 @@ extern "C" fn __preinit__00_panic_hook() { } /// Our own panic hook logging to the console. -fn panic_hook(info: &panic::PanicInfo) { +fn panic_hook(info: &panic::PanicHookInfo) { // Try to look into some string types we know (`&'static str` and `String`). let msg = match info.payload().downcast_ref::<&'static str>() { Some(s) => *s, diff --git a/crates/cli/src/config.rs b/crates/cli/src/config.rs index cfd2fe36f8a..069cebb7ea6 100644 --- a/crates/cli/src/config.rs +++ b/crates/cli/src/config.rs @@ -70,7 +70,7 @@ fn read_table<'a>(table: &'a toml_edit::Table, key: &'a str) -> Result Result, C Err(CliError::ConfigType { key: key.to_string(), kind: "string", - found: value.clone(), + found: Box::new(value.clone()), }) } } else { @@ -1000,7 +1000,7 @@ default_server = "local" CliError::ConfigType { key: "default_server".to_string(), kind: "string", - found: toml_edit::value(1), + found: Box::new(toml_edit::value(1)), }, )?; check_invalid( @@ -1008,7 +1008,7 @@ default_server = "local" CliError::ConfigType { key: "web_session_token".to_string(), kind: "string", - found: toml_edit::value(1), + found: Box::new(toml_edit::value(1)), }, )?; check_invalid( @@ -1016,7 +1016,7 @@ default_server = "local" CliError::ConfigType { key: "spacetimedb_token".to_string(), kind: "string", - found: toml_edit::value(1), + found: Box::new(toml_edit::value(1)), }, )?; check_invalid( @@ -1026,7 +1026,7 @@ default_server = "local" CliError::ConfigType { key: "server_configs".to_string(), kind: "table array", - found: toml_edit::table(), + found: Box::new(toml_edit::table()), }, )?; check_invalid( @@ -1037,7 +1037,7 @@ nickname =1 CliError::ConfigType { key: "nickname".to_string(), kind: "string", - found: toml_edit::value(1), + found: Box::new(toml_edit::value(1)), }, )?; check_invalid( @@ -1048,7 +1048,7 @@ host =1 CliError::ConfigType { key: "host".to_string(), kind: "string", - found: toml_edit::value(1), + found: Box::new(toml_edit::value(1)), }, )?; @@ -1061,7 +1061,7 @@ protocol =1 CliError::ConfigType { key: "protocol".to_string(), kind: "string", - found: toml_edit::value(1), + found: Box::new(toml_edit::value(1)), }, )?; Ok(()) diff --git a/crates/cli/src/errors.rs b/crates/cli/src/errors.rs index 07e626938f1..6de16692fb2 100644 --- a/crates/cli/src/errors.rs +++ b/crates/cli/src/errors.rs @@ -26,7 +26,7 @@ pub enum CliError { ConfigType { key: String, kind: &'static str, - found: toml_edit::Item, + found: Box, }, } diff --git a/crates/cli/src/subcommands/generate/rust.rs b/crates/cli/src/subcommands/generate/rust.rs index f948c6760ff..259620f72f9 100644 --- a/crates/cli/src/subcommands/generate/rust.rs +++ b/crates/cli/src/subcommands/generate/rust.rs @@ -621,7 +621,7 @@ pub fn type_name(module: &ModuleDef, ty: &AlgebraicTypeUse) -> String { s } -const ALLOW_UNUSED: &str = "#![allow(unused)]"; +const ALLOW_LINTS: &str = "#![allow(unused, clippy::all)]"; const SPACETIMEDB_IMPORTS: &[&str] = &[ "use spacetimedb_sdk::__codegen::{", @@ -639,7 +639,7 @@ fn print_spacetimedb_imports(output: &mut Indenter) { fn print_file_header(output: &mut Indenter) { print_auto_generated_file_comment(output); - write!(output, "{ALLOW_UNUSED}"); + writeln!(output, "{ALLOW_LINTS}"); print_spacetimedb_imports(output); } diff --git a/crates/cli/src/tasks/rust.rs b/crates/cli/src/tasks/rust.rs index 40f5bbf1ecc..9496ad8e64c 100644 --- a/crates/cli/src/tasks/rust.rs +++ b/crates/cli/src/tasks/rust.rs @@ -39,7 +39,7 @@ pub(crate) fn build_rust(project_path: &Path, lint_dir: Option<&Path>, build_deb for file in walkdir::WalkDir::new(lint_dir).into_iter() { let file = file?; let printable_path = file.path().to_str().ok_or(anyhow::anyhow!("path not utf-8"))?; - if file.file_type().is_file() && file.path().extension().map_or(false, |ext| ext == "rs") { + if file.file_type().is_file() && file.path().extension().is_some_and(|ext| ext == "rs") { let file = fs::File::open(file.path())?; for (idx, line) in io::BufReader::new(file).lines().enumerate() { let line = line?; diff --git a/crates/cli/tests/snapshots/codegen__codegen_rust.snap b/crates/cli/tests/snapshots/codegen__codegen_rust.snap index 4a1f4be0698..fb9309449ce 100644 --- a/crates/cli/tests/snapshots/codegen__codegen_rust.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_rust.snap @@ -1,13 +1,13 @@ --- source: crates/cli/tests/codegen.rs expression: outfiles -snapshot_kind: text --- "add_player_reducer.rs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -119,7 +119,8 @@ impl set_flags_for_add_player for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -231,7 +232,8 @@ impl set_flags_for_add_private for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -338,7 +340,8 @@ impl set_flags_for_assert_caller_identity_is_module_identity for super::SetReduc // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -363,7 +366,8 @@ impl __sdk::InModule for Baz { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -475,7 +479,8 @@ impl set_flags_for_delete_player for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -587,7 +592,8 @@ impl set_flags_for_delete_players_by_name for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -619,7 +625,8 @@ impl __sdk::InModule for Foobar { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -714,7 +721,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -740,7 +748,8 @@ impl __sdk::InModule for HasSpecialStuff { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -847,7 +856,8 @@ impl set_flags_for_init for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1023,7 +1033,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1596,7 +1607,8 @@ fn register_tables(client_cache: &mut __sdk::ClientCache) { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1624,7 +1636,8 @@ impl __sdk::InModule for NamespaceTestC { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1655,7 +1668,8 @@ impl __sdk::InModule for NamespaceTestF { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1762,7 +1776,8 @@ impl set_flags_for_on_connect for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1938,7 +1953,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -1964,7 +1980,8 @@ impl __sdk::InModule for PkMultiIdentity { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2140,7 +2157,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2167,7 +2185,8 @@ impl __sdk::InModule for Player { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2193,7 +2212,8 @@ impl __sdk::InModule for Point { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2288,7 +2308,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2383,7 +2404,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2408,7 +2430,8 @@ impl __sdk::InModule for Private { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2515,7 +2538,8 @@ impl set_flags_for_query_private for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2660,7 +2684,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2687,7 +2712,8 @@ impl __sdk::InModule for RepeatingTestArg { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2800,7 +2826,8 @@ impl set_flags_for_repeating_test for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2895,7 +2922,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2922,7 +2950,8 @@ impl __sdk::InModule for TestA { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -2947,7 +2976,8 @@ impl __sdk::InModule for TestB { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3054,7 +3084,8 @@ impl set_flags_for_test_btree_index_args for super::SetReducerFlags { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3150,7 +3181,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3176,7 +3208,8 @@ impl __sdk::InModule for TestD { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3321,7 +3354,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3347,7 +3381,8 @@ impl __sdk::InModule for TestE { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3443,7 +3478,8 @@ pub(super) fn parse_table_update( // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, @@ -3469,7 +3505,8 @@ impl __sdk::InModule for TestFoobar { // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. -#![allow(unused)]use spacetimedb_sdk::__codegen::{ +#![allow(unused, clippy::all)] +use spacetimedb_sdk::__codegen::{ self as __sdk, anyhow::{self as __anyhow, Context as _}, __lib, diff --git a/crates/client-api-messages/src/name/tests.rs b/crates/client-api-messages/src/name/tests.rs index fd5dbe4bed4..c171c3bd70b 100644 --- a/crates/client-api-messages/src/name/tests.rs +++ b/crates/client-api-messages/src/name/tests.rs @@ -149,7 +149,6 @@ fn test_tld_is_domain_name() { assert_eq!(None, dom.sub_domain()); } -#[cfg(feature = "serde")] mod serde { use super::*; diff --git a/crates/client-api/src/util/flat_csv.rs b/crates/client-api/src/util/flat_csv.rs index 095bce3000b..b01fe820da0 100644 --- a/crates/client-api/src/util/flat_csv.rs +++ b/crates/client-api/src/util/flat_csv.rs @@ -47,6 +47,7 @@ impl Separator for Comma { const CHAR: char = ','; } +#[allow(unused)] #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub(crate) enum SemiColon {} diff --git a/crates/commitlog/src/index/indexfile.rs b/crates/commitlog/src/index/indexfile.rs index ba1dd65d1fa..f7700464a7a 100644 --- a/crates/commitlog/src/index/indexfile.rs +++ b/crates/commitlog/src/index/indexfile.rs @@ -297,7 +297,7 @@ pub struct Entries<'a, K> { _key: PhantomData, } -impl<'a, K: From> Iterator for Entries<'a, K> { +impl> Iterator for Entries<'_, K> { type Item = Result<(K, u64), IndexError>; fn next(&mut self) -> Option { diff --git a/crates/commitlog/src/lib.rs b/crates/commitlog/src/lib.rs index 21f9f7a57d3..881aba4c223 100644 --- a/crates/commitlog/src/lib.rs +++ b/crates/commitlog/src/lib.rs @@ -67,8 +67,7 @@ pub struct Options { /// Setting it to `true` will update the index when the commitlog is synced, /// and `offset_index_interval_bytes` have been written. /// This means that the index could contain fewer index entries than - //// strictly every `offset_index_interval_bytes`. - + /// strictly every `offset_index_interval_bytes`. /// /// Default: false pub offset_index_require_segment_fsync: bool, diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index cf7000763bd..cd02c3a25e2 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -116,6 +116,8 @@ faststr = "0.2.23" unindexed_iter_by_col_range_warn = [] # Optional storage engines. default = ["unindexed_iter_by_col_range_warn"] +# Enable timing for wasm ABI calls +spacetimedb-wasm-instance-env-times = [] # Enable test helpers and utils test = [] diff --git a/crates/core/src/callgrind_flag.rs b/crates/core/src/callgrind_flag.rs index 499ce660d73..c1d90d951e1 100644 --- a/crates/core/src/callgrind_flag.rs +++ b/crates/core/src/callgrind_flag.rs @@ -27,7 +27,6 @@ use std::sync::atomic::{AtomicU32, Ordering}; /// `--collect-atstart=no --toggle-collect=`spacetimedb::callgrind_flag::flag*` /// Or, if using our fork of iai callgrind (https://github.com/clockworklabs/iai-callgrind), use: /// `LibraryBenchmarkConfig::default().with_custom_entry_point("spacetimedb::callgrind_flag::flag")`; - static CALLGRIND_ENABLED: AtomicU32 = AtomicU32::new(0); /// Invoke a function, enabling callgrind on all threads. diff --git a/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs b/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs index 99a072c6420..08ed501cc20 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs @@ -76,7 +76,8 @@ impl MemoryUsage for CommittedState { impl StateView for CommittedState { type Iter<'a> = IterTx<'a>; type IterByColRange<'a, R: RangeBounds> = IterByColRangeTx<'a, R>; - type IterByColEq<'a, 'r> = IterByColEqTx<'a, 'r> + type IterByColEq<'a, 'r> + = IterByColEqTx<'a, 'r> where Self: 'a; @@ -320,7 +321,7 @@ impl CommittedState { let table = self .tables .get_mut(&table_id) - .ok_or_else(|| TableError::IdNotFoundState(table_id))?; + .ok_or(TableError::IdNotFoundState(table_id))?; let blob_store = &mut self.blob_store; table .delete_equal_row(blob_store, rel) diff --git a/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs b/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs index 702ba326f43..5d19f5f7f07 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs @@ -411,12 +411,13 @@ impl TxDatastore for Locking { } impl MutTxDatastore for Locking { - type IterMutTx<'a>= IterMutTx<'a> + type IterMutTx<'a> + = IterMutTx<'a> where Self: 'a; type IterByColRangeMutTx<'a, R: RangeBounds> = IterByColRangeMutTx<'a, R>; type IterByColEqMutTx<'a, 'r> - = IterByColRangeMutTx<'a, &'r AlgebraicValue> + = IterByColRangeMutTx<'a, &'r AlgebraicValue> where Self: 'a; diff --git a/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs b/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs index 8bc95752679..29c31771972 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs @@ -468,7 +468,7 @@ impl MutTxId { // Note that the index could have been added in this tx. self.tx_state .index_id_map_removals - .get_or_insert_with(Default::default) + .get_or_insert_default() .insert(index_id); log::trace!("INDEX DROPPED: {}", index_id); @@ -596,13 +596,9 @@ impl MutTxId { AlgebraicType::Product(key_types) => { let key_types = &key_types.elements; // Split into types for the prefix and for the rest. - // TODO(centril): replace with `.split_at_checked(...)`. - if key_types.len() < prefix_elems.idx() { - return Err(DecodeError::Other( - "index key type has too few fields compared to prefix".into(), - )); - } - let (prefix_types, rest_types) = key_types.split_at(prefix_elems.idx()); + let (prefix_types, rest_types) = key_types + .split_at_checked(prefix_elems.idx()) + .ok_or_else(|| DecodeError::Other("index key type has too few fields compared to prefix".into()))?; // The `rstart` and `rend`s must be typed at `Bound`. // Extract that type and determine the length of the suffix. @@ -994,7 +990,7 @@ impl MutTxId { &sql.clone().into(), )? .next() - .ok_or_else(|| TableError::RawSqlNotFound(SystemTable::st_row_level_security, sql))?; + .ok_or(TableError::RawSqlNotFound(SystemTable::st_row_level_security, sql))?; self.delete(ST_ROW_LEVEL_SECURITY_ID, st_rls_ref.pointer())?; Ok(()) @@ -1602,7 +1598,7 @@ impl MutTxId { let (table, blob_store) = self .tx_state .get_table_and_blob_store(table_id) - .ok_or_else(|| TableError::IdNotFoundState(table_id))?; + .ok_or(TableError::IdNotFoundState(table_id))?; Ok(table.delete(blob_store, row_pointer, |_| ()).is_some()) } SquashedOffset::COMMITTED_STATE => { @@ -1687,7 +1683,8 @@ impl MutTxId { impl StateView for MutTxId { type Iter<'a> = IterMutTx<'a>; type IterByColRange<'a, R: RangeBounds> = IterByColRangeMutTx<'a, R>; - type IterByColEq<'a, 'r> = IterByColEqMutTx<'a, 'r> + type IterByColEq<'a, 'r> + = IterByColEqMutTx<'a, 'r> where Self: 'a; diff --git a/crates/core/src/db/datastore/locking_tx_datastore/tx.rs b/crates/core/src/db/datastore/locking_tx_datastore/tx.rs index e7960f329cf..ae155b0047f 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/tx.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/tx.rs @@ -40,7 +40,8 @@ impl Datastore for TxId { impl StateView for TxId { type Iter<'a> = IterTx<'a>; type IterByColRange<'a, R: RangeBounds> = IterByColRangeTx<'a, R>; - type IterByColEq<'a, 'r> = IterByColEqTx<'a, 'r> + type IterByColEq<'a, 'r> + = IterByColEqTx<'a, 'r> where Self: 'a; diff --git a/crates/core/src/db/datastore/traits.rs b/crates/core/src/db/datastore/traits.rs index a2128d09e20..d12df909471 100644 --- a/crates/core/src/db/datastore/traits.rs +++ b/crates/core/src/db/datastore/traits.rs @@ -65,16 +65,16 @@ use spacetimedb_table::table::RowRef; /// The ANSI SQL standard defined three anomalies in 1992: /// /// - Dirty Reads: Occur when a transaction reads data written by a concurrent -/// uncommitted transaction. +/// uncommitted transaction. /// /// - Non-repeatable Reads: Occur when a transaction reads the same row twice -/// and gets different data each time because another transaction has modified -/// the data in between the reads. +/// and gets different data each time because another transaction has modified +/// the data in between the reads. /// /// - Phantom Reads: Occur when a transaction re-executes a query returning a -/// set of rows that satisfy a search condition and finds that the set of rows -/// satisfying the condition has changed due to another recently-committed -/// transaction. +/// set of rows that satisfy a search condition and finds that the set of rows +/// satisfying the condition has changed due to another recently-committed +/// transaction. /// /// However since then database researchers have identified and cataloged many /// more. See: @@ -90,14 +90,14 @@ use spacetimedb_table::table::RowRef; /// The following anomalies are not part of the SQL standard, but are important: /// /// - Write Skew: Occurs when two transactions concurrently read the same data, -/// make decisions based on that data, and then write back modifications that -/// are mutually inconsistent with the decisions made by the other transaction, -/// despite no direct conflict on the same row being detected. e.g. I read what -/// you write and you read what I write. +/// make decisions based on that data, and then write back modifications that +/// are mutually inconsistent with the decisions made by the other transaction, +/// despite no direct conflict on the same row being detected. e.g. I read what +/// you write and you read what I write. /// /// - Serialization Anomalies: Occur when the results of a set of transactions -/// are inconsistent with any serial execution of those transactions. - +/// are inconsistent with any serial execution of those transactions. +/// /// PostgreSQL's documentation provides a good summary of the anomalies and /// isolation levels that it supports: /// diff --git a/crates/core/src/host/module_host.rs b/crates/core/src/host/module_host.rs index cceed4a506c..0bc5682a9b1 100644 --- a/crates/core/src/host/module_host.rs +++ b/crates/core/src/host/module_host.rs @@ -252,10 +252,6 @@ pub trait Module: Send + Sync + 'static { fn create_instance(&self) -> Self::Instance; fn replica_ctx(&self) -> &ReplicaContext; fn close(self); - #[cfg(feature = "tracelogging")] - fn get_trace(&self) -> Option; - #[cfg(feature = "tracelogging")] - fn stop_trace(&self) -> anyhow::Result<()>; } pub trait ModuleInstance: Send + 'static { diff --git a/crates/core/src/host/wasm_common/module_host_actor.rs b/crates/core/src/host/wasm_common/module_host_actor.rs index e70f17d004d..62f0f2a84a5 100644 --- a/crates/core/src/host/wasm_common/module_host_actor.rs +++ b/crates/core/src/host/wasm_common/module_host_actor.rs @@ -27,7 +27,6 @@ use crate::module_host_context::ModuleCreationContext; use crate::replica_context::ReplicaContext; use crate::sql::parser::RowLevelExpr; use crate::subscription::module_subscription_actor::WriteConflict; -use crate::util::const_unwrap; use crate::util::prometheus_handle::HistogramExt; use crate::worker_metrics::WORKER_METRICS; use spacetimedb_lib::buffer::DecodeError; @@ -71,6 +70,7 @@ pub struct EnergyStats { pub struct ExecutionTimings { pub total_duration: Duration, + #[expect(unused)] // TODO: do we want to do something with this? pub wasm_instance_env_call_times: CallTimes, } @@ -476,7 +476,7 @@ impl WasmModuleInstance { .record("timings.total_duration", tracing::field::debug(timings.total_duration)) .record("energy.used", tracing::field::debug(energy.used)); - const FRAME_LEN_60FPS: Duration = const_unwrap(Duration::from_secs(1).checked_div(60)); + const FRAME_LEN_60FPS: Duration = Duration::from_secs(1).checked_div(60).unwrap(); if timings.total_duration > FRAME_LEN_60FPS { // If we can't get your reducer done in a single frame we should debug it. tracing::debug!( diff --git a/crates/core/src/host/wasmtime/wasm_instance_env.rs b/crates/core/src/host/wasmtime/wasm_instance_env.rs index ffa45698517..2bf2aa5e322 100644 --- a/crates/core/src/host/wasmtime/wasm_instance_env.rs +++ b/crates/core/src/host/wasmtime/wasm_instance_env.rs @@ -414,6 +414,7 @@ impl WasmInstanceEnv { /// - `prefix = prefix_ptr[..prefix_len]`, /// - `rstart = rstart_ptr[..rstart_len]`, /// - `rend = rend_ptr[..rend_len]`, + /// /// in WASM memory. /// /// The index itself has a schema/type. @@ -566,8 +567,7 @@ impl WasmInstanceEnv { let mut written = 0; // Fill the buffer as much as possible. while let Some(chunk) = iter.as_slice().first() { - // TODO(Centril): refactor using `split_at_mut_checked`. - let Some(buf_chunk) = buffer.get_mut(..chunk.len()) else { + let Some((buf_chunk, rest)) = buffer.split_at_mut_checked(chunk.len()) else { // Cannot fit chunk into the buffer, // either because we already filled it too much, // or because it is too small. @@ -575,7 +575,7 @@ impl WasmInstanceEnv { }; buf_chunk.copy_from_slice(chunk); written += chunk.len(); - buffer = &mut buffer[chunk.len()..]; + buffer = rest; // Advance the iterator, as we used a chunk. // SAFETY: We peeked one `chunk`, so there must be one at least. @@ -751,6 +751,7 @@ impl WasmInstanceEnv { /// - `prefix = prefix_ptr[..prefix_len]`, /// - `rstart = rstart_ptr[..rstart_len]`, /// - `rend = rend_ptr[..rend_len]`, + /// /// in WASM memory. /// /// This syscall will delete all the rows found by diff --git a/crates/core/src/host/wasmtime/wasmtime_module.rs b/crates/core/src/host/wasmtime/wasmtime_module.rs index ab4966cd712..7c0d9261878 100644 --- a/crates/core/src/host/wasmtime/wasmtime_module.rs +++ b/crates/core/src/host/wasmtime/wasmtime_module.rs @@ -37,8 +37,7 @@ impl WasmtimeModule { pub const IMPLEMENTED_ABI: abi::VersionTuple = abi::VersionTuple::new(10, 0); pub(super) fn link_imports(linker: &mut Linker) -> anyhow::Result<()> { - #[allow(clippy::assertions_on_constants)] - const _: () = assert!(WasmtimeModule::IMPLEMENTED_ABI.major == spacetimedb_lib::MODULE_ABI_MAJOR_VERSION); + const { assert!(WasmtimeModule::IMPLEMENTED_ABI.major == spacetimedb_lib::MODULE_ABI_MAJOR_VERSION) }; macro_rules! link_functions { ($($module:literal :: $func:ident,)*) => { linker$(.func_wrap($module, stringify!($func), WasmInstanceEnv::$func)?)*; diff --git a/crates/core/src/subscription/tx.rs b/crates/core/src/subscription/tx.rs index 5355f3118a4..d8f4ae31829 100644 --- a/crates/core/src/subscription/tx.rs +++ b/crates/core/src/subscription/tx.rs @@ -19,7 +19,7 @@ impl<'a> DeltaTx<'a> { } } -impl<'a> Deref for DeltaTx<'a> { +impl Deref for DeltaTx<'_> { type Target = TxId; fn deref(&self) -> &Self::Target { diff --git a/crates/core/src/util/mod.rs b/crates/core/src/util/mod.rs index 0cb73c619c4..ab855d73e81 100644 --- a/crates/core/src/util/mod.rs +++ b/crates/core/src/util/mod.rs @@ -9,6 +9,7 @@ pub mod lending_pool; pub mod notify_once; pub mod slow; +// TODO: use String::from_utf8_lossy_owned once stabilized pub(crate) fn string_from_utf8_lossy_owned(v: Vec) -> String { match String::from_utf8_lossy(&v) { // SAFETY: from_utf8_lossy() returned Borrowed, which means the original buffer is valid utf8 @@ -17,14 +18,6 @@ pub(crate) fn string_from_utf8_lossy_owned(v: Vec) -> String { } } -#[track_caller] -pub const fn const_unwrap(o: Option) -> T { - match o { - Some(x) => x, - None => panic!("called `const_unwrap()` on a `None` value"), - } -} - #[tracing::instrument(level = "trace", skip_all)] pub fn spawn_rayon(f: impl FnOnce() -> R + Send + 'static) -> impl Future { let span = tracing::Span::current(); diff --git a/crates/core/src/vm.rs b/crates/core/src/vm.rs index 84c438445c8..b7d65b4618d 100644 --- a/crates/core/src/vm.rs +++ b/crates/core/src/vm.rs @@ -32,7 +32,7 @@ pub enum TxMode<'a> { Tx(&'a Tx), } -impl<'a> TxMode<'a> { +impl TxMode<'_> { /// Unwraps `self`, ensuring we are in a mutable tx. fn unwrap_mut(&mut self) -> &mut MutTx { match self { @@ -277,7 +277,7 @@ pub struct IndexSemiJoinLeft<'c, Rhs, IndexIter, F> { index_function: F, } -impl<'a, 'c, Rhs, IndexIter, F> IndexSemiJoinLeft<'c, Rhs, IndexIter, F> +impl<'a, Rhs, IndexIter, F> IndexSemiJoinLeft<'_, Rhs, IndexIter, F> where F: Fn(AlgebraicValue) -> Result, IndexIter: Iterator>, @@ -288,7 +288,7 @@ where } } -impl<'a, 'c, Rhs, IndexIter, F> RelOps<'a> for IndexSemiJoinLeft<'c, Rhs, IndexIter, F> +impl<'a, Rhs, IndexIter, F> RelOps<'a> for IndexSemiJoinLeft<'_, Rhs, IndexIter, F> where F: Fn(AlgebraicValue) -> Result, IndexIter: Iterator>, diff --git a/crates/lib/src/db/default_element_ordering.rs b/crates/lib/src/db/default_element_ordering.rs index 6d0f409473d..117725b1719 100644 --- a/crates/lib/src/db/default_element_ordering.rs +++ b/crates/lib/src/db/default_element_ordering.rs @@ -3,7 +3,6 @@ //! - In ABI version 8, the default ordering was not applied. //! - In ABI version 9, the default ordering is applied to all types in a spacetime module, unless they explicitly declare a custom ordering. -use crate::is_sorted; use spacetimedb_sats::{ProductType, ProductTypeElement, SumType, SumTypeVariant}; /// A label for a field of a `ProductType` or a variant of a `SumType`. @@ -40,20 +39,19 @@ impl<'a> From<(usize, &'a SumTypeVariant)> for ElementLabel<'a> { /// /// Not a recursive check. pub fn sum_type_has_default_ordering(ty: &SumType) -> bool { - is_sorted(ty.variants.iter().enumerate().map(ElementLabel::from)) + ty.variants.iter().enumerate().map(ElementLabel::from).is_sorted() } /// Checks if a product type has the default ordering. /// /// Not a recursive check. pub fn product_type_has_default_ordering(ty: &ProductType) -> bool { - is_sorted(ty.elements.iter().enumerate().map(ElementLabel::from)) + ty.elements.iter().enumerate().map(ElementLabel::from).is_sorted() } #[cfg(test)] mod tests { use super::*; - use proptest::proptest; #[test] fn test_element_label_comparison() { @@ -93,18 +91,4 @@ mod tests { assert!(e > d); assert!(e == e); } - - proptest! { - #[test] - fn test_is_sorted(v in proptest::collection::vec(0..100, 0..100)) { - let mut v: Vec = v; - v.sort(); - assert!(is_sorted(v.iter())); - } - } - - #[test] - fn test_is_not_sorted() { - assert!(!is_sorted([1, 2, 4, 3].iter())); - } } diff --git a/crates/lib/src/db/raw_def/v9.rs b/crates/lib/src/db/raw_def/v9.rs index f223f9b6e63..6d632531177 100644 --- a/crates/lib/src/db/raw_def/v9.rs +++ b/crates/lib/src/db/raw_def/v9.rs @@ -675,7 +675,7 @@ pub struct RawTableDefBuilder<'a> { table: RawTableDefV9, } -impl<'a> RawTableDefBuilder<'a> { +impl RawTableDefBuilder<'_> { /// Sets the type of the table and return it. /// /// This is not about column algebraic types, but about whether the table diff --git a/crates/lib/src/identity.rs b/crates/lib/src/identity.rs index 0cc0e2dbdfa..2029de3235a 100644 --- a/crates/lib/src/identity.rs +++ b/crates/lib/src/identity.rs @@ -70,7 +70,7 @@ impl Identity { pub const fn from_byte_array(bytes: [u8; 32]) -> Self { // SAFETY: The transmute is an implementation of `u256::from_le_bytes`, // but works in a const context. - Self::from_u256(u256::from_le(unsafe { mem::transmute(bytes) })) + Self::from_u256(u256::from_le(unsafe { mem::transmute::<[u8; 32], u256>(bytes) })) } /// Create an `Identity` from a BIG-ENDIAN byte array. @@ -83,9 +83,9 @@ impl Identity { /// [0xb0, 0xb1, 0xb2, ...] /// ``` pub const fn from_be_byte_array(bytes: [u8; 32]) -> Self { - // SAFETY: The transmute is an implementation of `u256::from_le_bytes`, + // SAFETY: The transmute is an implementation of `u256::from_be_bytes`, // but works in a const context. - Self::from_u256(u256::from_be(unsafe { mem::transmute(bytes) })) + Self::from_u256(u256::from_be(unsafe { mem::transmute::<[u8; 32], u256>(bytes) })) } /// Converts `__identity__: u256` to `Identity`. diff --git a/crates/lib/src/lib.rs b/crates/lib/src/lib.rs index 643c47cd0de..ca09c6df0ef 100644 --- a/crates/lib/src/lib.rs +++ b/crates/lib/src/lib.rs @@ -375,17 +375,3 @@ pub fn resolved_type_via_v9() -> AlgebraicType { .resolve_refs() .expect("recursive types not supported") } - -/// Check that an iterator is sorted. -/// -/// TODO: remove this when [`Iterator`::is_sorted`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.is_sorted) is stabilized. -pub fn is_sorted(mut it: impl Iterator) -> bool { - let Some(mut curr) = it.next() else { - return true; - }; - it.all(|next| { - let ordered = curr <= next; - curr = next; - ordered - }) -} diff --git a/crates/paths/src/cli.rs b/crates/paths/src/cli.rs index 4c786f52c05..f0f092fc4fc 100644 --- a/crates/paths/src/cli.rs +++ b/crates/paths/src/cli.rs @@ -17,8 +17,9 @@ impl ConfigDir { } } -path_type!(#[non_exhaustive(FALSE)] PrivKeyPath: file); -path_type!(#[non_exhaustive(FALSE)] PubKeyPath: file); +// TODO: replace cfg(any()) with cfg(false) once stabilized +path_type!(#[non_exhaustive(any())] PrivKeyPath: file); +path_type!(#[non_exhaustive(any())] PubKeyPath: file); path_type!(BinFile: file); diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs index 5ecb23a679c..fe34c5515d4 100644 --- a/crates/paths/src/lib.rs +++ b/crates/paths/src/lib.rs @@ -173,7 +173,8 @@ pub trait FromPathUnchecked { path_type! { /// The --root-dir for the spacetime installation, if specified. - #[non_exhaustive(FALSE)] + // TODO: replace cfg(any()) with cfg(false) once stabilized + #[non_exhaustive(any())] RootDir } diff --git a/crates/paths/src/utils.rs b/crates/paths/src/utils.rs index c44df061ce8..a03a9b87d9c 100644 --- a/crates/paths/src/utils.rs +++ b/crates/paths/src/utils.rs @@ -24,17 +24,18 @@ impl PathBufExt for PathBuf {} /// path_type! { /// /// optional docs /// // optional. if false, makes the type's constructor public. -/// #[non_exhaustive(FALSE)] +/// # // TODO: replace cfg(any()) with cfg(false) once stabilized (rust-lang/rust#131204) +/// #[non_exhaustive(any())] /// FooPath: dir // or file. adds extra utility methods for manipulating the file/dir /// } /// ``` #[macro_export] macro_rules! path_type { - ($(#[doc = $doc:literal])* $(#[non_exhaustive($non_exhaustive:tt)])? $name:ident) => { + ($(#[doc = $doc:literal])* $(#[non_exhaustive($($non_exhaustive:tt)+)])? $name:ident) => { $(#[doc = $doc])* #[derive(Clone, Debug, $crate::__serde::Serialize, $crate::__serde::Deserialize)] #[serde(transparent)] - #[cfg_attr(all($($non_exhaustive)?), non_exhaustive)] + #[cfg_attr(all($($($non_exhaustive)+)?), non_exhaustive)] pub struct $name(pub std::path::PathBuf); impl AsRef for $name { diff --git a/crates/physical-plan/src/plan.rs b/crates/physical-plan/src/plan.rs index dafc08b616f..62c9d30aeb8 100644 --- a/crates/physical-plan/src/plan.rs +++ b/crates/physical-plan/src/plan.rs @@ -466,13 +466,11 @@ impl PhysicalPlan { /// join c on b.id = c.id /// ``` fn introduce_semijoins(self, mut reqs: Vec