mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-22 20:52:27 +00:00
allow &mut State in async fn (needs test)
This commit is contained in:
parent
6ded517824
commit
ce570c4787
1 changed files with 2 additions and 2 deletions
|
@ -364,10 +364,10 @@ pub fn expand_method(method: Method, mut attrs: AttributeArgs, fun: ItemFn) -> R
|
|||
let mut block = quote!(#fun_ident(#(#args_pass),*));
|
||||
let mut state_block = quote!();
|
||||
if fun_is_async {
|
||||
if let Some(arg) = args.iter().find(|arg| (*arg).ty.is_state_ref()) {
|
||||
if let Some(arg) = args.iter().find(|arg| matches!((*arg).ty, MethodArgumentType::StateRef)) {
|
||||
return Err(Error::new(
|
||||
arg.span(),
|
||||
"async fn must not take &State as an argument as State is not Sync, consider boxing"
|
||||
"async fn must not take &State as an argument as State is not Sync, consider taking &mut State"
|
||||
));
|
||||
}
|
||||
block = quote!(#block.await);
|
||||
|
|
Loading…
Add table
Reference in a new issue