Skip to content

Commit

Permalink
chore: Review fix
Browse files Browse the repository at this point in the history
Pass handlers bracketed instead of parenthesized
  • Loading branch information
jawoznia committed Sep 17, 2024
1 parent 4e5dbec commit 71e5a76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions sylvia-derive/src/parser/attributes/msg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use proc_macro_error::emit_error;
use syn::parse::{Error, Parse, ParseStream, Parser};
use syn::{parenthesized, Ident, MetaList, Result, Token};
use syn::{bracketed, Ident, MetaList, Result, Token};

/// Type of message to be generated
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
Expand Down Expand Up @@ -35,8 +35,9 @@ impl Parse for ArgumentParser {
result.resp_type = Some(resp_type);
}
"handlers" => {
let _: Token![=] = input.parse()?;
let handlers_content;
parenthesized!(handlers_content in input);
bracketed!(handlers_content in input);

while !handlers_content.is_empty() {
let handler = handlers_content.parse::<Ident>()?;
Expand Down
4 changes: 2 additions & 2 deletions sylvia/tests/reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Contract {
}

#[allow(dead_code)]
#[sv::msg(reply, handlers(handler_one, handler_two))]
#[sv::msg(reply, handlers=[handler_one, handler_two])]
fn custom_handlers(&self, _ctx: ReplyCtx, _reply: Reply) -> StdResult<Response> {
Ok(Response::new())
}
Expand All @@ -39,7 +39,7 @@ impl Contract {
}

#[allow(dead_code)]
#[sv::msg(reply, handlers(handler_one, handler_two), reply_on = failure)]
#[sv::msg(reply, handlers=[handler_one, handler_two], reply_on = failure)]
fn both_parameters(&self, _ctx: ReplyCtx, _reply: Reply) -> StdResult<Response> {
Ok(Response::new())
}
Expand Down

0 comments on commit 71e5a76

Please sign in to comment.