mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-20 16:26:33 +00:00
Clean up checking code a bit
This commit is contained in:
@ -1115,18 +1115,14 @@ fn assert_last_param_is_slice(decl: &syn::FnDecl) -> Result<(), Diagnostic> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let arg = decl.inputs.last().ok_or_else(|| not_slice_error(&decl.inputs))?;
|
let arg = decl.inputs.last().ok_or_else(|| not_slice_error(&decl.inputs))?;
|
||||||
let ty = match arg.value() {
|
if let syn::FnArg::Captured(ref arg_cap) = arg.value() {
|
||||||
syn::FnArg::Captured(ref arg_cap) => &arg_cap.ty,
|
if let syn::Type::Reference(ref ref_ty) = arg_cap.ty {
|
||||||
_ => return Err(not_slice_error(&arg))
|
if let syn::Type::Slice(_) = *ref_ty.elem {
|
||||||
};
|
return Ok(())
|
||||||
match ty {
|
}
|
||||||
syn::Type::Reference(ref ref_ty) => match &*ref_ty.elem {
|
}
|
||||||
syn::Type::Slice(_) => Ok(()),
|
|
||||||
_ => Err(not_slice_error(ty))
|
|
||||||
},
|
|
||||||
_ => Err(not_slice_error(ty))
|
|
||||||
}
|
}
|
||||||
|
Err(not_slice_error(&arg))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the path is a single ident, return it.
|
/// If the path is a single ident, return it.
|
||||||
|
Reference in New Issue
Block a user