Use .. for (_).
This commit is contained in:
@@ -366,7 +366,7 @@ impl Parse for ExportedFn {
|
||||
}) => {
|
||||
matches!(flatten_type_groups(elem.as_ref()), syn::Type::Path(ref p) if p.path == str_type_path)
|
||||
}
|
||||
syn::Type::Verbatim(_) => false,
|
||||
syn::Type::Verbatim(..) => false,
|
||||
_ => true,
|
||||
};
|
||||
if !is_ok {
|
||||
@@ -381,13 +381,13 @@ impl Parse for ExportedFn {
|
||||
match fn_all.sig.output {
|
||||
syn::ReturnType::Type(.., ref ret_type) => {
|
||||
match flatten_type_groups(ret_type.as_ref()) {
|
||||
syn::Type::Ptr(_) => {
|
||||
syn::Type::Ptr(..) => {
|
||||
return Err(syn::Error::new(
|
||||
fn_all.sig.output.span(),
|
||||
"Rhai functions cannot return pointers",
|
||||
))
|
||||
}
|
||||
syn::Type::Reference(_) => {
|
||||
syn::Type::Reference(..) => {
|
||||
return Err(syn::Error::new(
|
||||
fn_all.sig.output.span(),
|
||||
"Rhai functions cannot return references",
|
||||
@@ -544,28 +544,28 @@ impl ExportedFn {
|
||||
|
||||
match params.special {
|
||||
// 2a. Property getters must take only the subject as an argument.
|
||||
FnSpecialAccess::Property(Property::Get(_)) if self.arg_count() != 1 => {
|
||||
FnSpecialAccess::Property(Property::Get(..)) if self.arg_count() != 1 => {
|
||||
return Err(syn::Error::new(
|
||||
self.signature.inputs.span(),
|
||||
"property getter requires exactly 1 parameter",
|
||||
))
|
||||
}
|
||||
// 2b. Property getters must return a value.
|
||||
FnSpecialAccess::Property(Property::Get(_)) if self.return_type().is_none() => {
|
||||
FnSpecialAccess::Property(Property::Get(..)) if self.return_type().is_none() => {
|
||||
return Err(syn::Error::new(
|
||||
self.signature.span(),
|
||||
"property getter must return a value",
|
||||
))
|
||||
}
|
||||
// 3a. Property setters must take the subject and a new value as arguments.
|
||||
FnSpecialAccess::Property(Property::Set(_)) if self.arg_count() != 2 => {
|
||||
FnSpecialAccess::Property(Property::Set(..)) if self.arg_count() != 2 => {
|
||||
return Err(syn::Error::new(
|
||||
self.signature.inputs.span(),
|
||||
"property setter requires exactly 2 parameters",
|
||||
))
|
||||
}
|
||||
// 3b. Non-raw property setters must return nothing.
|
||||
FnSpecialAccess::Property(Property::Set(_))
|
||||
FnSpecialAccess::Property(Property::Set(..))
|
||||
if params.return_raw.is_none() && self.return_type().is_some() =>
|
||||
{
|
||||
return Err(syn::Error::new(
|
||||
@@ -734,7 +734,7 @@ impl ExportedFn {
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
syn::FnArg::Receiver(_) => todo!("true self parameters not implemented yet"),
|
||||
syn::FnArg::Receiver(..) => todo!("true self parameters not implemented yet"),
|
||||
}
|
||||
unpack_exprs.push(syn::parse2::<syn::Expr>(quote! { #var }).unwrap());
|
||||
} else {
|
||||
@@ -811,7 +811,7 @@ impl ExportedFn {
|
||||
);
|
||||
}
|
||||
}
|
||||
syn::FnArg::Receiver(_) => panic!("internal error: how did this happen!?"),
|
||||
syn::FnArg::Receiver(..) => panic!("internal error: how did this happen!?"),
|
||||
}
|
||||
if !is_ref {
|
||||
unpack_exprs.push(syn::parse2::<syn::Expr>(quote! { #var }).unwrap());
|
||||
|
Reference in New Issue
Block a user