Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Modules] spacetimedb(index) macro now uses more consistent parens. #97

Merged
merged 1 commit into from
Jul 24, 2023
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
7 changes: 4 additions & 3 deletions crates/bindings-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl syn::parse::Parse for MacroInput {
// Extract stuff in parens.
let in_parens;
syn::parenthesized!(in_parens in input);
let in_parens = &in_parens;

// Parse `btree` or `hash`.
let ty: IndexType = in_parens.parse()?;
Expand All @@ -206,11 +207,11 @@ impl syn::parse::Parse for MacroInput {
// Also find plain identifiers that become field names to index.
let mut name = None;
let mut field_names = Vec::new();
comma_then_comma_delimited(input, || {
match_tok!(match input {
comma_then_comma_delimited(in_parens, || {
match_tok!(match in_parens {
(tok, _) @ (kw::name, Token![=]) => {
check_duplicate(&name, tok.span)?;
let v = input.parse::<syn::LitStr>()?;
let v = in_parens.parse::<syn::LitStr>()?;
name = Some(v.value())
}
ident @ Ident => field_names.push(ident),
Expand Down
2 changes: 1 addition & 1 deletion modules/benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub fn find_unique_location(id: u64) {
}

#[spacetimedb(table)]
#[spacetimedb(index(btree), name = "id", id)]
#[spacetimedb(index(btree, name = "id", id))]
pub struct NonuniqueLocation {
id: u64,
x: u64,
Expand Down
2 changes: 1 addition & 1 deletion modules/rust-wasm-test/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build]
target = "wasm32-unknown-unknown"
target = "wasm32-unknown-unknown"
2 changes: 1 addition & 1 deletion modules/rust-wasm-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use spacetimedb::{
use spacetimedb_lib::bsatn;

#[spacetimedb(table)]
#[spacetimedb(index(btree), name = "foo", x)]
#[spacetimedb(index(btree, name = "foo", x))]
pub struct TestA {
pub x: u32,
pub y: u32,
Expand Down
4 changes: 2 additions & 2 deletions test/tests/filtering.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn find_person_by_nick(nick: String) {
}

#[spacetimedb(table)]
#[spacetimedb(index(btree), name = "by_id", id)]
#[spacetimedb(index(btree, name = "by_id", id))]
pub struct NonuniquePerson {
id: i32,
name: String,
Expand Down Expand Up @@ -137,7 +137,7 @@ fn find_identified_person(id_number: u64) {

// Ensure that indices on non-unique columns behave as we expect.
#[spacetimedb(table)]
#[spacetimedb(index(btree), name="person_surname", surname)]
#[spacetimedb(index(btree, name="person_surname", surname))]
struct IndexedPerson {
#[unique]
id: i32,
Expand Down