diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/ffi/lib.rs | 11 | ||||
-rw-r--r-- | ext/net/io.rs | 1 | ||||
-rw-r--r-- | ext/net/ops.rs | 1 |
3 files changed, 10 insertions, 3 deletions
diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs index 6d0bda649..1d400069e 100644 --- a/ext/ffi/lib.rs +++ b/ext/ffi/lib.rs @@ -97,7 +97,9 @@ struct Symbol { } #[allow(clippy::non_send_fields_in_send_ty)] +// SAFETY: unsafe trait must have unsafe implementation unsafe impl Send for Symbol {} +// SAFETY: unsafe trait must have unsafe implementation unsafe impl Sync for Symbol {} #[derive(Clone)] @@ -123,7 +125,9 @@ impl PtrSymbol { } #[allow(clippy::non_send_fields_in_send_ty)] +// SAFETY: unsafe trait must have unsafe implementation unsafe impl Send for PtrSymbol {} +// SAFETY: unsafe trait must have unsafe implementation unsafe impl Sync for PtrSymbol {} struct DynamicLibraryResource { @@ -363,7 +367,7 @@ impl NativeValue { } NativeType::ISize => { let value = self.isize_value; - if value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER { + if !(MIN_SAFE_INTEGER..=MAX_SAFE_INTEGER).contains(&value) { json!(U32x2::from(self.isize_value as u64)) } else { Value::from(value) @@ -458,7 +462,7 @@ impl NativeValue { NativeType::ISize => { let value = self.isize_value; let local_value: v8::Local<v8::Value> = - if value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER { + if !(MIN_SAFE_INTEGER..=MAX_SAFE_INTEGER).contains(&value) { v8::BigInt::new_from_i64(scope, self.isize_value as i64).into() } else { v8::Number::new(scope, value as f64).into() @@ -489,6 +493,7 @@ impl NativeValue { } } +// SAFETY: unsafe trait must have unsafe implementation unsafe impl Send for NativeValue {} #[derive(Serialize, Debug, Clone, Copy)] @@ -1979,7 +1984,7 @@ fn op_ffi_get_static<'scope>( // SAFETY: ptr is user provided let result = unsafe { ptr::read_unaligned(data_ptr as *const isize) }; let integer: v8::Local<v8::Value> = - if result > MAX_SAFE_INTEGER || result < MIN_SAFE_INTEGER { + if !(MIN_SAFE_INTEGER..=MAX_SAFE_INTEGER).contains(&result) { v8::BigInt::new_from_i64(scope, result as i64).into() } else { v8::Number::new(scope, result as f64).into() diff --git a/ext/net/io.rs b/ext/net/io.rs index 02caf7473..c9587c851 100644 --- a/ext/net/io.rs +++ b/ext/net/io.rs @@ -136,6 +136,7 @@ impl TcpStreamResource { .map_socket(Box::new(move |socket| Ok(socket.set_keepalive(keepalive)?))) } + #[allow(clippy::type_complexity)] fn map_socket( self: Rc<Self>, map: Box<dyn FnOnce(SockRef) -> Result<(), AnyError>>, diff --git a/ext/net/ops.rs b/ext/net/ops.rs index 87bfc3272..a05c21da8 100644 --- a/ext/net/ops.rs +++ b/ext/net/ops.rs @@ -1047,6 +1047,7 @@ mod tests { check_sockopt(String::from("127.0.0.1:4246"), set_keepalive, test_fn).await; } + #[allow(clippy::type_complexity)] async fn check_sockopt( addr: String, set_sockopt_fn: Box<dyn Fn(&mut OpState, u32)>, |