Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhuw committed Oct 15, 2024
1 parent 3b15e03 commit d5b6ca4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ impl Client {
/// # Cautions
/// * Holds returned watcher without polling events may result in memory burst.
/// * At the time of written, ZooKeeper [ZOOKEEPER-4466][] does not support oneshot and
/// persistent watch on same path.
/// persistent watch on same path.
/// * Persistent watch could lose events during reconnection due to [ZOOKEEPER-4698][].
///
/// [ZOOKEEPER-4466]: https://issues.apache.org/jira/browse/ZOOKEEPER-4466
Expand Down Expand Up @@ -1137,8 +1137,8 @@ impl Client {
///
/// # Error handling on [Error::ConnectionLoss]
/// * If connection loss during lock path creation, this method will find out the created lock
/// path if creation success by matching prefix for [LockPrefix::new_curator] or ephemeral
/// owner for others.
/// path if creation success by matching prefix for [LockPrefix::new_curator] or ephemeral
/// owner for others.
/// * Retry all other operations on connection loss.
///
/// # Notable issues
Expand Down Expand Up @@ -1287,7 +1287,7 @@ impl<'a> LockPrefix<'a> {
///
/// # Notable usages
/// * Uses "{dir}/x-{session_id}-" as `prefix` and "x-" or "" as `name` for ZooKeeper java
/// client's [WriteLock].
/// client's [WriteLock].
///
/// [WriteLock]: https://github.com/apache/zookeeper/blob/release-3.9.0/zookeeper-recipes/zookeeper-recipes-lock/src/main/java/org/apache/zookeeper/recipes/lock/WriteLock.java#L212
pub fn new_custom(prefix: String, name: &'a str) -> Result<Self> {
Expand Down
8 changes: 6 additions & 2 deletions src/session/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub trait AsyncReadToBuf: AsyncReadExt {
where
Self: Unpin, {
let chunk = buf.chunk_mut();
let read_to = unsafe { std::mem::transmute(chunk.as_uninit_slice_mut()) };
let read_to =
unsafe { std::mem::transmute::<&mut [std::mem::MaybeUninit<u8>], &mut [u8]>(chunk.as_uninit_slice_mut()) };
let n = self.read(read_to).await?;
if n != 0 {
unsafe {
Expand Down Expand Up @@ -246,7 +247,10 @@ impl Connector {
i += 1;
match self.connect(endpoint, &mut deadline).await {
Ok(conn) => match conn.command_isro().await {
Ok(true) => return Some(unsafe { std::mem::transmute(endpoint) }),
// Safety: https://github.com/rust-lang/rust/issues/74068
Ok(true) => {
return Some(unsafe { std::mem::transmute::<EndpointRef<'_>, EndpointRef<'_>>(endpoint) })
},
Ok(false) => trace!("succeeds to contact readonly {}", endpoint),
Err(err) => trace!(%err, r#"fails to complete "isro" to {}"#, endpoint),
},
Expand Down
6 changes: 5 additions & 1 deletion src/session/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ pub struct MarshalledRequest(pub Vec<u8>);
#[derive(Clone, Copy, Debug)]
pub enum OpStat<'a> {
None,
#[allow(dead_code)]
Path(&'a str),
Watch { path: &'a str, mode: WatchMode },
Watch {
path: &'a str,
mode: WatchMode,
},
}

impl MarshalledRequest {
Expand Down

0 comments on commit d5b6ca4

Please sign in to comment.