style: clippy fix

This commit is contained in:
LongYinan 2021-11-25 23:35:50 +08:00
parent aaf1bd14ea
commit c365c15639
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7

View file

@ -264,28 +264,24 @@ impl NapiFn {
quote! { quote! {
<#ty as napi::bindgen_prelude::ToNapiValue>::to_napi_value(env, #ret) <#ty as napi::bindgen_prelude::ToNapiValue>::to_napi_value(env, #ret)
} }
} else if is_return_self {
quote! { #ret.map(|_| cb.this) }
} else { } else {
if is_return_self { quote! {
quote! { #ret.map(|_| cb.this) } match #ret {
} else { Ok(value) => napi::bindgen_prelude::ToNapiValue::to_napi_value(env, value),
quote! { Err(err) => {
match #ret { napi::bindgen_prelude::JsError::from(err).throw_into(env);
Ok(value) => napi::bindgen_prelude::ToNapiValue::to_napi_value(env, value), Ok(std::ptr::null_mut())
Err(err) => { },
napi::bindgen_prelude::JsError::from(err).throw_into(env);
Ok(std::ptr::null_mut())
},
}
} }
} }
} }
} else if is_return_self {
quote! { Ok(cb.this) }
} else { } else {
if is_return_self { quote! {
quote! { Ok(cb.this) } <#ty as napi::bindgen_prelude::ToNapiValue>::to_napi_value(env, #ret)
} else {
quote! {
<#ty as napi::bindgen_prelude::ToNapiValue>::to_napi_value(env, #ret)
}
} }
} }
} else { } else {