Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Postponed] Rust: Add deny(unsafe_op_in_unsafe_fn) lint. #157

Draft
wants to merge 5 commits into
base: rust/integ_yuryf_unsafe
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion glide-core/src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

mod types;

use crate::scripts_container::get_script;
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/client/reconnecting_connection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use super::{NodeAddress, TlsMode};
use crate::retry_strategies::RetryStrategy;
use futures_intrusive::sync::ManualResetEvent;
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/client/standalone_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use super::get_redis_connection_info;
use super::reconnecting_connection::ReconnectingConnection;
use super::{ConnectionRequest, NodeAddress, TlsMode};
Expand Down
2 changes: 2 additions & 0 deletions glide-core/src/client/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use std::time::Duration;

#[cfg(feature = "socket-layer")]
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/client/value_conversion.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use redis::{
cluster_routing::Routable, from_owned_redis_value, Cmd, ErrorKind, RedisResult, Value,
};
Expand Down
2 changes: 2 additions & 0 deletions glide-core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use redis::RedisError;

#[repr(C)]
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/request_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use redis::{cmd, Cmd};

#[cfg(feature = "socket-layer")]
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/retry_strategies.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use crate::client::ConnectionRetryStrategy;
use std::time::Duration;
use tokio_retry::strategy::{jitter, ExponentialBackoff};
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/rotating_buffer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use bytes::BytesMut;
use integer_encoding::VarInt;
use logger_core::log_error;
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/scripts_container.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use arcstr::ArcStr;
use logger_core::log_info;
use once_cell::sync::Lazy;
Expand Down
5 changes: 4 additions & 1 deletion glide-core/src/socket_listener.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use super::rotating_buffer::RotatingBuffer;
use crate::client::Client;
use crate::connection_request::ConnectionRequest;
Expand Down
12 changes: 10 additions & 2 deletions java/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/**
/*
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#![deny(unsafe_op_in_unsafe_fn)]

use glide_core::start_socket_listener;

use jni::objects::{JClass, JObject, JObjectArray, JString, JThrowable};
Expand Down Expand Up @@ -95,8 +98,13 @@ fn redis_value_to_java<'local>(env: &mut JNIEnv<'local>, val: Value) -> JObject<
}
}

/// # Safety
///
/// * `pointer` must point to a valid `Value` obtained from a [protobuf response](https://github.com/aws/glide-for-redis/blob/main/glide-core/src/protobuf/response.proto).
#[no_mangle]
pub extern "system" fn Java_glide_ffi_resolvers_RedisValueResolver_valueFromPointer<'local>(
pub unsafe extern "system" fn Java_glide_ffi_resolvers_RedisValueResolver_valueFromPointer<
'local,
>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
pointer: jlong,
Expand Down
Loading