1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-22 20:52:27 +00:00

also detect _state as state argument

This commit is contained in:
Dominic 2020-04-30 16:48:50 +02:00
parent a36993f615
commit 8593e133b7
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -181,7 +181,8 @@ fn interpret_arg_ty(attrs : &[Attribute], name : &str, ty : Type) -> Result<Meth
.find(|arg| arg.path.segments.iter().any(|path| &path.ident.to_string() == "rest_arg"))
.map(|arg| arg.tokens.to_string());
if attr.as_deref() == Some("state") || (attr.is_none() && name == "state")
// TODO issue a warning for _state usage once diagnostics become stable
if attr.as_deref() == Some("state") || (attr.is_none() && (name == "state" || name == "_state"))
{
return match ty {
Type::Reference(ty) => Ok(if ty.mutability.is_none() { MethodArgumentType::StateRef } else { MethodArgumentType::StateMutRef }),