Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20 # on a successful run, runs in 8 minutes
container:
image: rust:1.83.0
image: rust:1.88.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')) }}
Expand Down
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ debug = true
version = "1.2.0"
edition = "2021"
# update rust-toolchain.toml too!
rust-version = "1.84.0"
rust-version = "1.88.0"

[workspace.dependencies]
spacetimedb = { path = "crates/bindings", version = "1.2.0" }
Expand Down Expand Up @@ -326,3 +326,10 @@ features = [
"broadcast",
"ondemand",
]

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }

[workspace.lints.clippy]
# FIXME: we should work on this lint incrementally
result_large_err = "allow"
3 changes: 3 additions & 0 deletions crates/auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ jsonwebtoken.workspace = true

[dev-dependencies]
serde_json.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@ tikv-jemalloc-ctl = { workspace = true }
iai-callgrind = { git = "https://github.com/clockworklabs/iai-callgrind.git", branch = "main" }
iai-callgrind-runner = { git = "https://github.com/clockworklabs/iai-callgrind.git", branch = "main" }
iai-callgrind-macros = { git = "https://github.com/clockworklabs/iai-callgrind.git", branch = "main" }

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See the README for commands to run.

# sync with: ../../rust-toolchain.toml
FROM rust:1.84.0
FROM rust:1.88.0

RUN apt-get update && \
apt-get install -y valgrind bash && \
Expand Down
4 changes: 2 additions & 2 deletions crates/bench/src/bin/summarize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mod criterion {

/// `"{crit_dir}/"{name}.json"`
fn packed_baseline_json_path(crit_dir: &Path, name: &str) -> PathBuf {
crit_dir.join(format!("{}.json", name))
crit_dir.join(format!("{name}.json"))
}

lazy_static::lazy_static! {
Expand Down Expand Up @@ -392,7 +392,7 @@ mod callgrind {
}

fn packed_json_path(iai_callgrind_dir: &Path, name: &str) -> PathBuf {
iai_callgrind_dir.join(format!("{}.json", name))
iai_callgrind_dir.join(format!("{name}.json"))
}

fn get_iai_callgrind_dir(target_dir: &Path) -> PathBuf {
Expand Down
4 changes: 2 additions & 2 deletions crates/bench/src/spacetime_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ impl<L: ModuleLanguage> BenchDatabase for SpacetimeModule<L> {
});

for table in module.client.module.info.module_def.tables() {
log::trace!("SPACETIME_MODULE: LOADED TABLE: {:?}", table);
log::trace!("SPACETIME_MODULE: LOADED TABLE: {table:?}");
}
for reducer in module.client.module.info.module_def.reducers() {
log::trace!("SPACETIME_MODULE: LOADED REDUCER: {:?}", reducer);
log::trace!("SPACETIME_MODULE: LOADED REDUCER: {reducer:?}");
}
Ok(SpacetimeModule {
runtime,
Expand Down
3 changes: 3 additions & 0 deletions crates/bindings-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ proc-macro2.workspace = true
quote.workspace = true
syn.workspace = true
heck.workspace = true

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/bindings-macro/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ pub(crate) fn table_impl(mut args: TableArgs, item: &syn::DeriveInput) -> syn::R
if std::env::var("PROC_MACRO_DEBUG").is_ok() {
{
#![allow(clippy::disallowed_macros)]
println!("{}", emission);
println!("{emission}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bindings-macro/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub(crate) fn one_of(options: &[crate::sym::Symbol]) -> String {
}
_ => {
let join = options.join("`, `");
format!("expected one of: `{}`", join)
format!("expected one of: `{join}`")
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/bindings-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ unstable = []

[dependencies]
spacetimedb-primitives.workspace = true

[lints]
workspace = true
50 changes: 25 additions & 25 deletions crates/bindings-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub mod raw {
///
/// Traps if:
/// - `prefix_elems > 0`
/// and (`prefix_ptr` is NULL or `prefix` is not in bounds of WASM memory).
/// and (`prefix_ptr` is NULL or `prefix` is not in bounds of WASM memory).
/// - `rstart` is NULL or `rstart` is not in bounds of WASM memory.
/// - `rend` is NULL or `rend` is not in bounds of WASM memory.
/// - `out` is NULL or `out[..size_of::<RowIter>()]` is not in bounds of WASM memory.
Expand All @@ -161,11 +161,11 @@ pub mod raw {
/// - `NO_SUCH_INDEX`, when `index_id` is not a known ID of an index.
/// - `WRONG_INDEX_ALGO` if the index is not a range-compatible index.
/// - `BSATN_DECODE_ERROR`, when `prefix` cannot be decoded to
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
pub fn datastore_index_scan_range_bsatn(
index_id: IndexId,
prefix_ptr: *const u8,
Expand Down Expand Up @@ -212,7 +212,7 @@ pub mod raw {
///
/// Traps if:
/// - `prefix_elems > 0`
/// and (`prefix_ptr` is NULL or `prefix` is not in bounds of WASM memory).
/// and (`prefix_ptr` is NULL or `prefix` is not in bounds of WASM memory).
/// - `rstart` is NULL or `rstart` is not in bounds of WASM memory.
/// - `rend` is NULL or `rend` is not in bounds of WASM memory.
/// - `out` is NULL or `out[..size_of::<u32>()]` is not in bounds of WASM memory.
Expand All @@ -225,11 +225,11 @@ pub mod raw {
/// - `NO_SUCH_INDEX`, when `index_id` is not a known ID of an index.
/// - `WRONG_INDEX_ALGO` if the index is not a range-compatible index.
/// - `BSATN_DECODE_ERROR`, when `prefix` cannot be decoded to
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
pub fn datastore_delete_by_index_scan_range_bsatn(
index_id: IndexId,
prefix_ptr: *const u8,
Expand Down Expand Up @@ -364,7 +364,7 @@ pub mod raw {
/// - `NOT_IN_TRANSACTION`, when called outside of a transaction.
/// - `NO_SUCH_TABLE`, when `table_id` is not a known ID of a table.
/// - `BSATN_DECODE_ERROR`, when `row` cannot be decoded to a `ProductValue`.
/// typed at the `ProductType` the table's schema specifies.
/// typed at the `ProductType` the table's schema specifies.
/// - `UNIQUE_ALREADY_EXISTS`, when inserting `row` would violate a unique constraint.
/// - `SCHEDULE_AT_DELAY_TOO_LONG`, when the delay specified in the row was too long.
pub fn datastore_insert_bsatn(table_id: TableId, row_ptr: *mut u8, row_len_ptr: *mut usize) -> u16;
Expand Down Expand Up @@ -406,8 +406,8 @@ pub mod raw {
/// - `INDEX_NOT_UNIQUE`, when the index was not unique.
/// - `NO_SUCH_ROW`, when the row was not found in the unique index.
/// - `BSATN_DECODE_ERROR`, when `row` cannot be decoded to a `ProductValue`
/// typed at the `ProductType` the table's schema specifies
/// or when it cannot be projected to the index identified by `index_id`.
/// typed at the `ProductType` the table's schema specifies
/// or when it cannot be projected to the index identified by `index_id`.
/// - `UNIQUE_ALREADY_EXISTS`, when inserting `row` would violate a unique constraint.
/// - `SCHEDULE_AT_DELAY_TOO_LONG`, when the delay specified in the row was too long.
pub fn datastore_update_bsatn(
Expand Down Expand Up @@ -942,11 +942,11 @@ pub fn datastore_table_scan_bsatn(table_id: TableId) -> Result<RowIter, Errno> {
/// - `NO_SUCH_INDEX`, when `index_id` is not a known ID of an index.
/// - `WRONG_INDEX_ALGO` if the index is not a range-compatible index.
/// - `BSATN_DECODE_ERROR`, when `prefix` cannot be decoded to
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
pub fn datastore_index_scan_range_bsatn(
index_id: IndexId,
prefix: &[u8],
Expand Down Expand Up @@ -990,11 +990,11 @@ pub fn datastore_index_scan_range_bsatn(
/// - `NO_SUCH_INDEX`, when `index_id` is not a known ID of an index.
/// - `WRONG_INDEX_ALGO` if the index is not a range-compatible index.
/// - `BSATN_DECODE_ERROR`, when `prefix` cannot be decoded to
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
/// a `prefix_elems` number of `AlgebraicValue`
/// typed at the initial `prefix_elems` `AlgebraicType`s of the index's key type.
/// Or when `rstart` or `rend` cannot be decoded to an `Bound<AlgebraicValue>`
/// where the inner `AlgebraicValue`s are
/// typed at the `prefix_elems + 1` `AlgebraicType` of the index's key type.
pub fn datastore_delete_by_index_scan_range_bsatn(
index_id: IndexId,
prefix: &[u8],
Expand Down
3 changes: 3 additions & 0 deletions crates/bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ getrandom02 = { workspace = true, optional = true, features = ["custom"] }
[dev-dependencies]
insta.workspace = true
trybuild.workspace = true

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ const DEFAULT_BUFFER_CAPACITY: usize = spacetimedb_primitives::ROW_ITER_CHUNK_SI
#[doc(hidden)]
pub fn table_id_from_name(table_name: &str) -> TableId {
sys::table_id_from_name(table_name).unwrap_or_else(|_| {
panic!("Failed to get table with name: {}", table_name);
panic!("Failed to get table with name: {table_name}");
})
}

Expand Down
43 changes: 5 additions & 38 deletions crates/bindings/tests/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,12 @@
//! to make sure we don't unknowingly add a bunch of dependencies here,
//! slowing down compilation for every spacetime module.

// We need to remove the `cpufeatures` and `libc` dependencies from the output, it added on `arm` architecture:
// https://github.com/RustCrypto/sponges/blob/master/keccak/Cargo.toml#L24-L25, breaking local testing.
#[cfg(target_arch = "aarch64")]
fn hack_keccack(cmd: String) -> String {
let mut found = false;
let mut lines = cmd.lines().peekable();
let mut output = String::new();

while let Some(line) = lines.next() {
// Check we only match keccak/cpufeatures/libc
if line.contains("keccak") {
found = true;
}
if found && line.contains("cpufeatures") {
if let Some(next_line) = lines.peek() {
if next_line.contains("libc") {
found = false;
// Skip libc
lines.next();
continue;
}
}
}
output.push_str(line);
output.push('\n');
}

output
}
#[cfg(not(target_arch = "aarch64"))]
fn hack_keccack(cmd: String) -> String {
cmd
}

#[test]
fn deptree_snapshot() -> std::io::Result<()> {
let cmd = "cargo tree -p spacetimedb -f {lib} -e no-dev";
let deps_tree = hack_keccack(run_cmd(cmd));
let all_deps = hack_keccack(run_cmd("cargo tree -p spacetimedb -e no-dev --prefix none --no-dedupe"));
let cmd_common = "cargo tree -p spacetimedb -e no-dev --color never --target wasm32-unknown-unknown";
let cmd = &format!("{cmd_common} -f {{lib}}");
let deps_tree = run_cmd(cmd);
let all_deps = run_cmd(&format!("{cmd_common} --prefix none --no-dedupe"));
let mut all_deps = all_deps.lines().collect::<Vec<_>>();
all_deps.sort();
all_deps.dedup();
Expand All @@ -52,7 +19,7 @@ fn deptree_snapshot() -> std::io::Result<()> {
cmd
);

let cmd = "cargo tree -p spacetimedb -e no-dev -d --depth 0";
let cmd = &format!("{cmd_common} -d --depth 0");
insta::assert_snapshot!("duplicate_deps", run_cmd(cmd), cmd);

Ok(())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
source: crates/bindings/tests/deps.rs
expression: "cargo tree -p spacetimedb -f {lib} -e no-dev"
expression: "cargo tree -p spacetimedb -e no-dev --color never --target wasm32-unknown-unknown -f {lib}"
---
total crates: 61
total crates: 60
spacetimedb
├── bytemuck
├── derive_more
Expand All @@ -19,11 +19,9 @@ spacetimedb
│ └── rustc_version
│ └── semver
├── getrandom
│ ├── cfg_if
│ └── libc
│ └── cfg_if
├── log
├── rand
│ ├── libc
│ ├── rand_chacha
│ │ ├── ppv_lite86
│ │ │ └── zerocopy
Expand All @@ -44,7 +42,12 @@ spacetimedb
│ │ └── nohash_hasher
│ └── syn (*)
├── spacetimedb_bindings_sys
│ └── spacetimedb_primitives (*)
│ └── spacetimedb_primitives
│ ├── bitflags
│ ├── either
│ ├── itertools
│ │ └── either
│ └── nohash_hasher
├── spacetimedb_lib
│ ├── anyhow
│ ├── bitflags
Expand Down
3 changes: 3 additions & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ tikv-jemalloc-ctl = { workspace = true }

[target.'cfg(windows)'.dependencies]
windows-sys = { workspace = true, features = ["Win32_System_Console"] }

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ use std::process::Command;
fn main() {
let output = Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
println!("cargo:rustc-env=GIT_HASH={git_hash}");
}
2 changes: 1 addition & 1 deletion crates/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ Fetch the server's fingerprint with:

let cfg = self.find_server_mut(server)?;
let old_nickname = if let Some(new_nickname) = new_nickname {
std::mem::replace(&mut cfg.nickname, Some(new_nickname.to_string()))
cfg.nickname.replace(new_nickname.to_string())
} else {
None
};
Expand Down
Loading
Loading