mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-16 22:41:24 +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 ty = match arg.value() {
|
||||
syn::FnArg::Captured(ref arg_cap) => &arg_cap.ty,
|
||||
_ => return Err(not_slice_error(&arg))
|
||||
};
|
||||
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))
|
||||
if let syn::FnArg::Captured(ref arg_cap) = arg.value() {
|
||||
if let syn::Type::Reference(ref ref_ty) = arg_cap.ty {
|
||||
if let syn::Type::Slice(_) = *ref_ty.elem {
|
||||
return Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Err(not_slice_error(&arg))
|
||||
}
|
||||
|
||||
/// If the path is a single ident, return it.
|
||||
|
Reference in New Issue
Block a user