diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 2c69e0ef06e..89c9fa7c21c 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -184,7 +184,8 @@ jobs: runs-on: spacetimedb-linux timeout-minutes: 20 # on a successful run, runs in 8 minutes container: - image: rust:1.93.0 + # !rust-toolchain-sync + image: rust:1.98.1 options: --privileged # disable until we fix the benchmarks if: false diff --git a/Cargo.toml b/Cargo.toml index a2b27d448c4..202d316990e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -144,7 +144,7 @@ debug = true version = "2.10.1" edition = "2024" # update rust-toolchain.toml too! -rust-version = "1.93.0" +rust-version = "1.98.1" [workspace.dependencies] spacetimedb = { path = "crates/bindings", version = "=2.10.1" } diff --git a/crates/bench/Dockerfile b/crates/bench/Dockerfile index 0f64f819c82..64919db3aae 100644 --- a/crates/bench/Dockerfile +++ b/crates/bench/Dockerfile @@ -2,8 +2,8 @@ # Set up to run from linux / WSL (running from a windows file system will be extremely slow). # See the README for commands to run. -# sync with: ../../rust-toolchain.toml -FROM rust:1.93.0 +# !rust-toolchain-sync +FROM rust:1.98.1 RUN apt-get update && \ apt-get install -y valgrind bash && \ diff --git a/crates/cli/src/subcommands/dev.rs b/crates/cli/src/subcommands/dev.rs index 95cc579182f..d24344b6490 100644 --- a/crates/cli/src/subcommands/dev.rs +++ b/crates/cli/src/subcommands/dev.rs @@ -1270,7 +1270,7 @@ async fn select_database(config: &Config, server: &str, token: &str) -> Result = stream::iter(result.identities.into_iter()) + let databases: Vec = stream::iter(result.identities) .map(|identity_str| { let config = config.clone(); async move { diff --git a/crates/cli/src/subcommands/repl.rs b/crates/cli/src/subcommands/repl.rs index 6561475ca92..9e4d7e5b50d 100644 --- a/crates/cli/src/subcommands/repl.rs +++ b/crates/cli/src/subcommands/repl.rs @@ -61,7 +61,7 @@ pub(crate) async fn exec(con: Connection, format: Format) -> Result<(), anyhow:: let api = ClientApi::new(con); loop { - let readline = rl.readline(&format!("🪐{}>", &database).green()); + let readline = rl.readline(&format!("🪐{}>", database).green()); match readline { Ok(line) => match line.as_str() { ".exit" => break, diff --git a/crates/codegen/src/unrealcpp.rs b/crates/codegen/src/unrealcpp.rs index a521e739180..f5d03e3f3de 100644 --- a/crates/codegen/src/unrealcpp.rs +++ b/crates/codegen/src/unrealcpp.rs @@ -416,7 +416,7 @@ impl Lang for UnrealCpp<'_> { let name = type_ref_name(self.module_prefix, module, typ.ty); let filename = format!( "Source/{}/Public/ModuleBindings/Types/{}Type.g.h", - self.module_name, &name + self.module_name, name ); let code: String = match &module.typespace_for_generate()[typ.ty] { AlgebraicTypeDef::PlainEnum(plain_enum) => autogen_cpp_enum(&name, plain_enum), diff --git a/crates/commitlog/src/segment.rs b/crates/commitlog/src/segment.rs index c810e2399ae..c67246f8cf3 100644 --- a/crates/commitlog/src/segment.rs +++ b/crates/commitlog/src/segment.rs @@ -16,7 +16,7 @@ use crate::{ Options, }; -pub const MAGIC: [u8; 6] = [b'(', b'd', b's', b')', b'^', b'2']; +pub const MAGIC: [u8; 6] = *b"(ds)^2"; pub const DEFAULT_LOG_FORMAT_VERSION: u8 = 1; pub const DEFAULT_CHECKSUM_ALGORITHM: u8 = CHECKSUM_ALGORITHM_CRC32C; diff --git a/crates/core/src/host/instance_env.rs b/crates/core/src/host/instance_env.rs index 97609d60bb3..76f605d2244 100644 --- a/crates/core/src/host/instance_env.rs +++ b/crates/core/src/host/instance_env.rs @@ -406,7 +406,7 @@ impl InstanceEnv { /// End a console timer by logging the span at INFO level. pub(crate) fn console_timer_end(&self, span: &TimingSpan, function: Option<&str>) { let elapsed = span.start.elapsed(); - let message = format!("Timing span {:?}: {:?}", &span.name, elapsed); + let message = format!("Timing span {:?}: {:?}", span.name, elapsed); self.console_log_simple_message(LogLevel::Info, function, &message); } diff --git a/crates/core/src/host/v8/error.rs b/crates/core/src/host/v8/error.rs index 54095f657cf..aa462506bef 100644 --- a/crates/core/src/host/v8/error.rs +++ b/crates/core/src/host/v8/error.rs @@ -520,7 +520,7 @@ impl fmt::Display for JsStackTraceFrame { // TODO(v8): make it more like chrome in the future. f.write_fmt(format_args!( "at {} ({}:{}:{})", - fn_name, script_name, &self.line, &self.column + fn_name, script_name, self.line, self.column ))?; if self.is_ctor { diff --git a/crates/datastore/src/locking_tx_datastore/datastore.rs b/crates/datastore/src/locking_tx_datastore/datastore.rs index 1082e0ae9c6..205de3567fe 100644 --- a/crates/datastore/src/locking_tx_datastore/datastore.rs +++ b/crates/datastore/src/locking_tx_datastore/datastore.rs @@ -229,9 +229,8 @@ impl Locking { /// error. pub fn take_snapshot(&self, repo: &DynSnapshotRepo) -> Result> { Self::take_snapshot_internal(&self.committed_state, repo)? - .map(|(_offset, snap)| snap.sync_all()) + .map(|(_offset, snap)| snap.sync_all().map_err(Into::into)) .transpose() - .map_err(Into::into) } pub fn assert_system_tables_match(&self) -> Result<()> { @@ -3021,7 +3020,7 @@ pub(crate) mod tests { fn assert_rows(datastore: &Locking, table_id: TableId, rows: Vec) -> ResultTest<()> { let tx = begin_tx(datastore); - for (actual, expected) in datastore.iter_tx(&tx, table_id)?.zip_eq(rows.into_iter()) { + for (actual, expected) in datastore.iter_tx(&tx, table_id)?.zip_eq(rows) { assert_eq!(actual.to_bsatn_vec()?, expected.to_bsatn_vec()?); } Ok(()) diff --git a/crates/engine/src/relational_db.rs b/crates/engine/src/relational_db.rs index 19cda5b6fbe..800148f9251 100644 --- a/crates/engine/src/relational_db.rs +++ b/crates/engine/src/relational_db.rs @@ -627,13 +627,10 @@ impl RelationalDB { // Try to restore from any snapshot that was taken within the // range `(min_commitlog_offset + 1)..=durable_tx_offset`. let mut upper_bound = durable_tx_offset; - loop { - let Some(snapshot_offset) = snapshot_repo - .latest_snapshot_older_than(upper_bound) - .map_err(Box::new)? - else { - break; - }; + while let Some(snapshot_offset) = snapshot_repo + .latest_snapshot_older_than(upper_bound) + .map_err(Box::new)? + { if min_commitlog_offset > 0 && min_commitlog_offset > snapshot_offset + 1 { log::debug!("snapshot_offset={snapshot_offset} min_commitlog_offset={min_commitlog_offset}"); break; diff --git a/crates/engine/src/update.rs b/crates/engine/src/update.rs index 5b9e6e0fde2..ab864688d1c 100644 --- a/crates/engine/src/update.rs +++ b/crates/engine/src/update.rs @@ -705,7 +705,7 @@ pub fn create_table_from_view_def( view_def: &ViewDef, ) -> anyhow::Result<()> { stdb.create_view(tx, module_def, view_def) - .with_context(|| format!("failed to create table for view {}", &view_def.name))?; + .with_context(|| format!("failed to create table for view {}", view_def.name))?; Ok(()) } @@ -719,7 +719,7 @@ pub fn create_table_from_view_def_with_prefix( name_prefix: &NamespacePath, ) -> anyhow::Result<()> { stdb.create_view_with_prefix(tx, owning_def, view_def, name_prefix) - .with_context(|| format!("failed to create table for view {}{}", name_prefix, &view_def.name))?; + .with_context(|| format!("failed to create table for view {}{}", name_prefix, view_def.name))?; Ok(()) } diff --git a/crates/lib/src/lib.rs b/crates/lib/src/lib.rs index 55d5621a16d..0ee6395186b 100644 --- a/crates/lib/src/lib.rs +++ b/crates/lib/src/lib.rs @@ -40,12 +40,12 @@ pub use filterable_value::Private; pub use filterable_value::{FilterableValue, IndexScanRangeBoundsTerminator, TermBound, ViewPrimaryKeyColumn}; pub use identity::Identity; pub use scheduler::ScheduleAt; +pub use spacetimedb_sats::__make_register_reftype; pub use spacetimedb_sats::hash::{self, hash_bytes, Hash}; pub use spacetimedb_sats::time_duration::TimeDuration; pub use spacetimedb_sats::timestamp::Timestamp; pub use spacetimedb_sats::uuid::Uuid; pub use spacetimedb_sats::SpacetimeType; -pub use spacetimedb_sats::__make_register_reftype; pub use spacetimedb_sats::{self as sats, bsatn, buffer, de, ser}; pub use spacetimedb_sats::{AlgebraicType, ProductType, ProductTypeElement, SumType}; pub use spacetimedb_sats::{AlgebraicValue, ProductValue}; diff --git a/crates/pg/src/pg_server.rs b/crates/pg/src/pg_server.rs index f1de39f4efd..361da919418 100644 --- a/crates/pg/src/pg_server.rs +++ b/crates/pg/src/pg_server.rs @@ -157,6 +157,7 @@ where let params = self.cached.lock().await.clone().unwrap(); let name_or_identity = database::NameOrIdentity::Name(DatabaseName(params.database.clone())); let database_identity = response(name_or_identity.resolve(&self.ctx).await, ¶ms.database).await?; + #[expect(clippy::result_large_err)] let database = response( self.ctx .get_database_by_identity(&database_identity) diff --git a/crates/schema/src/def.rs b/crates/schema/src/def.rs index e324d93b0ea..455f2e37235 100644 --- a/crates/schema/src/def.rs +++ b/crates/schema/src/def.rs @@ -1362,6 +1362,7 @@ impl TableDef { impl From for RawTableDefV9 { fn from(val: TableDef) -> Self { + #[expect(clippy::unneeded_wildcard_pattern)] let TableDef { name, product_type_ref, diff --git a/crates/schema/src/def/validate/v10.rs b/crates/schema/src/def/validate/v10.rs index 11fbcf4e3d4..a57d56a9212 100644 --- a/crates/schema/src/def/validate/v10.rs +++ b/crates/schema/src/def/validate/v10.rs @@ -398,7 +398,7 @@ fn validate_submodules(submodules: Vec) -> Result errors.extend(e.into_iter()), + Err(e) => errors.extend(e), } } } diff --git a/crates/sqltest/src/main.rs b/crates/sqltest/src/main.rs index 7856008afd3..304042fc21c 100644 --- a/crates/sqltest/src/main.rs +++ b/crates/sqltest/src/main.rs @@ -449,15 +449,11 @@ async fn update_test_file { - if sql.contains("NOT_REWRITE") { - continue; - } + Record::Statement { sql, .. } if sql.contains("NOT_REWRITE") => { + continue; } - Record::Query { sql, .. } => { - if sql.contains("NOT_REWRITE") { - continue; - } + Record::Query { sql, .. } if sql.contains("NOT_REWRITE") => { + continue; } _ => (), } diff --git a/crates/standalone/Dockerfile b/crates/standalone/Dockerfile index fa74fa1f232..1a9cfa1aaba 100644 --- a/crates/standalone/Dockerfile +++ b/crates/standalone/Dockerfile @@ -1,7 +1,8 @@ ARG CARGO_PROFILE=release -FROM rust:1.93.0 AS chef +# !rust-toolchain-sync +FROM rust:1.98.1 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.70 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 28f0403f3d4..7676abe47ec 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,8 +1,7 @@ [toolchain] -# change crates/{standalone,bench}/Dockerfile, .github/Dockerfile, and the docker image tag in -# .github/workflows/benchmarks.yml:jobs/callgrind_benchmark/container/image -# maybe also the rust-version in Cargo.toml -channel = "1.93.0" +# run ./tools/rust-toolchain-sync.sh when you change the channel! +# also consider changing the rust-version in Cargo.toml +channel = "1.98.1" profile = "default" targets = ["wasm32-unknown-unknown"] components = ["rust-src"] diff --git a/sdks/rust/src/db_connection.rs b/sdks/rust/src/db_connection.rs index 137166ae614..c1810f7e5dd 100644 --- a/sdks/rust/src/db_connection.rs +++ b/sdks/rust/src/db_connection.rs @@ -19,7 +19,6 @@ //! This module is internal, and may incompatibly change without warning. use crate::{ - Event, ReducerEvent, Status, __codegen::{InternalError, Reducer}, callbacks::{ CallbackId, DbCallbacks, ProcedureCallback, ProcedureCallbacks, ReducerCallback, ReducerCallbacks, RowCallback, @@ -29,6 +28,7 @@ use crate::{ spacetime_module::{AbstractEventContext, AppliedDiff, DbConnection, DbUpdate, InModule, SpacetimeModule}, subscription::{PendingUnsubscribeResult, SubscriptionHandleImpl, SubscriptionManager}, websocket::{WsConnection, WsParams}, + Event, ReducerEvent, Status, }; use bytes::Bytes; use futures::StreamExt; diff --git a/sdks/rust/src/spacetime_module.rs b/sdks/rust/src/spacetime_module.rs index dfec381e56d..cba7c73122b 100644 --- a/sdks/rust/src/spacetime_module.rs +++ b/sdks/rust/src/spacetime_module.rs @@ -3,12 +3,12 @@ //! This module is internal, and may incompatibly change without warning. use crate::{ + __codegen::InternalError, callbacks::DbCallbacks, client_cache::ClientCache, db_connection::DbContextImpl, subscription::{OnEndedCallback, SubscriptionHandleImpl}, Event, ReducerEvent, - __codegen::InternalError, }; use bytes::Bytes; use spacetimedb_client_api_messages::websocket::{self as ws, common::RowListLen as _, v2::BsatnRowList}; diff --git a/tools/ci/commands/update-flow/src/main.rs b/tools/ci/commands/update-flow/src/main.rs index 273e5f26efc..be9d99b8460 100644 --- a/tools/ci/commands/update-flow/src/main.rs +++ b/tools/ci/commands/update-flow/src/main.rs @@ -56,7 +56,7 @@ fn main() -> Result<()> { ["run", "-p", "spacetimedb-update"] .into_iter() .chain(common_args.clone()) - .chain(["--", "self-install", &root_arg, "--yes"].into_iter()), + .chain(["--", "self-install", &root_arg, "--yes"]), ) .run()?; diff --git a/tools/release/src/crates_resolver.rs b/tools/release/src/crates_resolver.rs index 3412ecf93da..158cfcc441c 100644 --- a/tools/release/src/crates_resolver.rs +++ b/tools/release/src/crates_resolver.rs @@ -72,9 +72,9 @@ pub fn get_crate_deps(crate_name: &String, manifest_map: &HashMap&2 "$0: couldn't extract version from rust-toolchain.toml" + exit 1 +} + +rg -.F "$MAGIC_COMMENT" -l "$@" | xargs gawk -i inplace -v toolchain_ver="$toolchain" " +/$MAGIC_COMMENT/ { version = 1; print; next } +{ if (version) { gsub(/$VERSION_REGEX/, toolchain_ver); version = 0; } print } +" diff --git a/tools/xtask-llm-benchmark/src/bin/llm_benchmark.rs b/tools/xtask-llm-benchmark/src/bin/llm_benchmark.rs index be76423286d..2b6caaa1ada 100644 --- a/tools/xtask-llm-benchmark/src/bin/llm_benchmark.rs +++ b/tools/xtask-llm-benchmark/src/bin/llm_benchmark.rs @@ -564,7 +564,7 @@ fn model_filter_from_groups(groups: Option>) -> Option> = HashMap::new(); for g in groups { - out.entry(g.vendor).or_default().extend(g.models.into_iter()); + out.entry(g.vendor).or_default().extend(g.models); } Some(out) } diff --git a/tools/xtask-llm-benchmark/src/context/combine.rs b/tools/xtask-llm-benchmark/src/context/combine.rs index ac8eb278c1b..9c3b1a2f59f 100644 --- a/tools/xtask-llm-benchmark/src/context/combine.rs +++ b/tools/xtask-llm-benchmark/src/context/combine.rs @@ -163,7 +163,7 @@ fn build_context_from_rustdoc_json() -> Result { }); } - rows.sort_by(|a, b| (order_key(&a.kind), a.path.to_lowercase()).cmp(&(order_key(&b.kind), b.path.to_lowercase()))); + rows.sort_by_key(|a| (order_key(&a.kind), a.path.to_lowercase())); let mut out = String::with_capacity(1024 * 1024); out.push_str(&format!(