fix(napi-derive): ignore warnings on generated fn

Close https://github.com/napi-rs/napi-rs/issues/968
This commit is contained in:
LongYinan 2021-12-25 01:23:38 +08:00
parent 76798a4343
commit f76a12eb5a
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
2 changed files with 4 additions and 0 deletions

View file

@ -130,6 +130,8 @@ impl NapiEnum {
let js_mod_ident = js_mod_to_token_stream(self.js_mod.as_ref()); let js_mod_ident = js_mod_to_token_stream(self.js_mod.as_ref());
quote! { quote! {
#[allow(non_snake_case)]
#[allow(clippy::all)]
unsafe fn #callback_name(env: napi::bindgen_prelude::sys::napi_env) -> napi::bindgen_prelude::Result<napi::bindgen_prelude::sys::napi_value> { unsafe fn #callback_name(env: napi::bindgen_prelude::sys::napi_env) -> napi::bindgen_prelude::Result<napi::bindgen_prelude::sys::napi_value> {
use std::ffi::CString; use std::ffi::CString;
use std::ptr; use std::ptr;

View file

@ -306,6 +306,8 @@ impl NapiFn {
Span::call_site(), Span::call_site(),
); );
quote! { quote! {
#[allow(non_snake_case)]
#[allow(clippy::all)]
unsafe fn #cb_name(env: napi::bindgen_prelude::sys::napi_env) -> napi::bindgen_prelude::Result<napi::bindgen_prelude::sys::napi_value> { unsafe fn #cb_name(env: napi::bindgen_prelude::sys::napi_env) -> napi::bindgen_prelude::Result<napi::bindgen_prelude::sys::napi_value> {
let mut fn_ptr = std::ptr::null_mut(); let mut fn_ptr = std::ptr::null_mut();