Fix warnings for tasks that take mutable parameters
#[task] pub async fn run(mut param: Param) {} warning: variable does not need to be mutable
This commit is contained in:
parent
cd56d2621a
commit
c17954ccba
@ -55,9 +55,9 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let mut arg_names: syn::punctuated::Punctuated<syn::Ident, syn::Token![,]> =
|
let mut arg_names: syn::punctuated::Punctuated<syn::Ident, syn::Token![,]> =
|
||||||
syn::punctuated::Punctuated::new();
|
syn::punctuated::Punctuated::new();
|
||||||
let args = &task_fn.sig.inputs;
|
let mut args = task_fn.sig.inputs.clone();
|
||||||
|
|
||||||
for arg in args.iter() {
|
for arg in args.iter_mut() {
|
||||||
match arg {
|
match arg {
|
||||||
syn::FnArg::Receiver(_) => {
|
syn::FnArg::Receiver(_) => {
|
||||||
arg.span()
|
arg.span()
|
||||||
@ -66,8 +66,11 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
.emit();
|
.emit();
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
syn::FnArg::Typed(t) => match t.pat.as_ref() {
|
syn::FnArg::Typed(t) => match t.pat.as_mut() {
|
||||||
syn::Pat::Ident(i) => arg_names.push(i.ident.clone()),
|
syn::Pat::Ident(i) => {
|
||||||
|
arg_names.push(i.ident.clone());
|
||||||
|
i.mutability = None;
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
arg.span()
|
arg.span()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
Loading…
Reference in New Issue
Block a user