Skip to content

Commit 800ed28

Browse files
committed
Fix lint errors
1 parent 7938217 commit 800ed28

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/client/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ impl Client {
859859
/// # Cautions
860860
/// * Holds returned watcher without polling events may result in memory burst.
861861
/// * At the time of written, ZooKeeper [ZOOKEEPER-4466][] does not support oneshot and
862-
/// persistent watch on same path.
862+
/// persistent watch on same path.
863863
/// * Persistent watch could lose events during reconnection due to [ZOOKEEPER-4698][].
864864
///
865865
/// [ZOOKEEPER-4466]: https://issues.apache.org/jira/browse/ZOOKEEPER-4466
@@ -1137,8 +1137,8 @@ impl Client {
11371137
///
11381138
/// # Error handling on [Error::ConnectionLoss]
11391139
/// * If connection loss during lock path creation, this method will find out the created lock
1140-
/// path if creation success by matching prefix for [LockPrefix::new_curator] or ephemeral
1141-
/// owner for others.
1140+
/// path if creation success by matching prefix for [LockPrefix::new_curator] or ephemeral
1141+
/// owner for others.
11421142
/// * Retry all other operations on connection loss.
11431143
///
11441144
/// # Notable issues
@@ -1287,7 +1287,7 @@ impl<'a> LockPrefix<'a> {
12871287
///
12881288
/// # Notable usages
12891289
/// * Uses "{dir}/x-{session_id}-" as `prefix` and "x-" or "" as `name` for ZooKeeper java
1290-
/// client's [WriteLock].
1290+
/// client's [WriteLock].
12911291
///
12921292
/// [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
12931293
pub fn new_custom(prefix: String, name: &'a str) -> Result<Self> {

src/session/connection.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ pub trait AsyncReadToBuf: AsyncReadExt {
4040
where
4141
Self: Unpin, {
4242
let chunk = buf.chunk_mut();
43-
let read_to = unsafe { std::mem::transmute(chunk.as_uninit_slice_mut()) };
43+
let read_to =
44+
unsafe { std::mem::transmute::<&mut [std::mem::MaybeUninit<u8>], &mut [u8]>(chunk.as_uninit_slice_mut()) };
4445
let n = self.read(read_to).await?;
4546
if n != 0 {
4647
unsafe {
@@ -246,7 +247,10 @@ impl Connector {
246247
i += 1;
247248
match self.connect(endpoint, &mut deadline).await {
248249
Ok(conn) => match conn.command_isro().await {
249-
Ok(true) => return Some(unsafe { std::mem::transmute(endpoint) }),
250+
// Safety: https://github.com/rust-lang/rust/issues/74068
251+
Ok(true) => {
252+
return Some(unsafe { std::mem::transmute::<EndpointRef<'_>, EndpointRef<'_>>(endpoint) })
253+
},
250254
Ok(false) => trace!("succeeds to contact readonly {}", endpoint),
251255
Err(err) => trace!(%err, r#"fails to complete "isro" to {}"#, endpoint),
252256
},

src/session/request.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ pub struct MarshalledRequest(pub Vec<u8>);
1818
#[derive(Clone, Copy, Debug)]
1919
pub enum OpStat<'a> {
2020
None,
21+
#[allow(dead_code)]
2122
Path(&'a str),
22-
Watch { path: &'a str, mode: WatchMode },
23+
Watch {
24+
path: &'a str,
25+
mode: WatchMode,
26+
},
2327
}
2428

2529
impl MarshalledRequest {

0 commit comments

Comments
 (0)