From 486765b35efd75400c6e737388d3569633eb655c Mon Sep 17 00:00:00 2001 From: liulinboyi <814921718@qq.com> Date: Sat, 18 Dec 2021 11:52:49 +0800 Subject: [PATCH] feat(napi): refine return type --- crates/napi/src/bindgen_runtime/js_values/buffer.rs | 2 +- crates/napi/src/js_values/arraybuffer.rs | 2 +- crates/napi/src/js_values/buffer.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/napi/src/bindgen_runtime/js_values/buffer.rs b/crates/napi/src/bindgen_runtime/js_values/buffer.rs index 66fd324a..ebe3382c 100644 --- a/crates/napi/src/bindgen_runtime/js_values/buffer.rs +++ b/crates/napi/src/bindgen_runtime/js_values/buffer.rs @@ -37,7 +37,7 @@ impl AsMut<[u8]> for Buffer { impl Deref for Buffer { type Target = [u8]; - fn deref(&self) -> &[u8] { + fn deref(&self) -> &Self::Target { self.inner.as_slice() } } diff --git a/crates/napi/src/js_values/arraybuffer.rs b/crates/napi/src/js_values/arraybuffer.rs index 76c654fd..da624536 100644 --- a/crates/napi/src/js_values/arraybuffer.rs +++ b/crates/napi/src/js_values/arraybuffer.rs @@ -216,7 +216,7 @@ impl AsMut<[u8]> for JsArrayBufferValue { impl Deref for JsArrayBufferValue { type Target = [u8]; - fn deref(&self) -> &[u8] { + fn deref(&self) -> &Self::Target { self.as_ref() } } diff --git a/crates/napi/src/js_values/buffer.rs b/crates/napi/src/js_values/buffer.rs index a0a7fcb2..1ce009de 100644 --- a/crates/napi/src/js_values/buffer.rs +++ b/crates/napi/src/js_values/buffer.rs @@ -86,7 +86,7 @@ impl AsMut<[u8]> for JsBufferValue { impl Deref for JsBufferValue { type Target = [u8]; - fn deref(&self) -> &[u8] { + fn deref(&self) -> &Self::Target { self.data.as_slice() } }