Fix ui tests.

This commit is contained in:
Stephen Chung 2020-10-15 14:06:54 +08:00
parent 3c9250b0bf
commit 8abb3c5203
6 changed files with 13 additions and 13 deletions

View File

@ -261,7 +261,7 @@ impl Parse for ExportedFn {
ref elem,
..
}) => match flatten_type_groups(elem.as_ref()) {
&syn::Type::Path(ref p) if p.path == str_type_path => false,
syn::Type::Path(ref p) if p.path == str_type_path => false,
_ => {
return Err(syn::Error::new(
ty.span(),
@ -296,7 +296,7 @@ impl Parse for ExportedFn {
ref elem,
..
}) => {
matches!(flatten_type_groups(elem.as_ref()), &syn::Type::Path(ref p) if p.path == str_type_path)
matches!(flatten_type_groups(elem.as_ref()), syn::Type::Path(ref p) if p.path == str_type_path)
}
syn::Type::Verbatim(_) => false,
_ => true,
@ -632,8 +632,8 @@ impl ExportedFn {
let var = syn::Ident::new("arg0", proc_macro2::Span::call_site());
match first_arg {
syn::FnArg::Typed(pattern) => {
let arg_type: &syn::Type = match flatten_type_groups(pattern.ty.as_ref()) {
&syn::Type::Reference(syn::TypeReference { ref elem, .. }) => elem.as_ref(),
let arg_type = match flatten_type_groups(pattern.ty.as_ref()) {
syn::Type::Reference(syn::TypeReference { ref elem, .. }) => elem.as_ref(),
p => p,
};
let downcast_span = quote_spanned!(
@ -670,14 +670,14 @@ impl ExportedFn {
let is_ref;
match arg {
syn::FnArg::Typed(pattern) => {
let arg_type: &syn::Type = pattern.ty.as_ref();
let arg_type = pattern.ty.as_ref();
let downcast_span = match flatten_type_groups(pattern.ty.as_ref()) {
&syn::Type::Reference(syn::TypeReference {
syn::Type::Reference(syn::TypeReference {
mutability: None,
ref elem,
..
}) => match flatten_type_groups(elem.as_ref()) {
&syn::Type::Path(ref p) if p.path == str_type_path => {
syn::Type::Path(ref p) if p.path == str_type_path => {
is_string = true;
is_ref = true;
quote_spanned!(arg_type.span()=>
@ -685,7 +685,7 @@ impl ExportedFn {
}
_ => panic!("internal error: why wasn't this found earlier!?"),
},
&syn::Type::Path(ref p) if p.path == string_type_path => {
syn::Type::Path(ref p) if p.path == string_type_path => {
is_string = true;
is_ref = false;
quote_spanned!(arg_type.span()=>

View File

@ -38,7 +38,7 @@ pub(crate) fn generate_body(
if itemmod.skipped() {
continue;
}
let module_name: &syn::Ident = itemmod.module_name().unwrap();
let module_name = itemmod.module_name().unwrap();
let exported_name: syn::LitStr = if let Some(name) = itemmod.exported_name() {
syn::LitStr::new(&name, proc_macro2::Span::call_site())
} else {

View File

@ -1,4 +1,4 @@
error: return_raw functions must return Result<T>
error: return_raw functions must return Result<T, Box<EvalAltResult>>
--> $DIR/export_fn_raw_noreturn.rs:10:5
|
10 | pub fn test_fn(input: &mut Point) {

View File

@ -1,4 +1,4 @@
error: return_raw functions must return Result<T>
error: return_raw functions must return Result<T, Box<EvalAltResult>>
--> $DIR/export_mod_raw_noreturn.rs:12:5
|
12 | pub fn test_fn(input: &mut Point) {

View File

@ -1,4 +1,4 @@
error: Rhai functions cannot return pointers
error: Rhai functions cannot return references
--> $DIR/return_shared_ref.rs:12:33
|
12 | pub fn test_fn(input: Clonable) -> &'static str {

View File

@ -1,4 +1,4 @@
error: property setter must return no value
error: property setter cannot return any value
--> $DIR/rhai_fn_setter_return.rs:13:9
|
13 | pub fn test_fn(input: &mut Point, value: f32) -> bool {