Skip to content

Commit

Permalink
chore: prevent warnings from test-only functions and traits
Browse files Browse the repository at this point in the history
  • Loading branch information
hjr3 committed Nov 3, 2024
1 parent 87f8d89 commit 7346290
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ pin_project! {
///
/// The returned future will resolve to both the I/O stream and the buffer
/// as well as the number of bytes read once the read operation is completed.
#[cfg(test)]
fn read<'a, R>(reader: &'a mut R, buf: &'a mut [u8]) -> ReadFut<'a, R>
where
R: Read + Unpin + ?Sized,
Expand All @@ -587,6 +588,7 @@ where
}
}

#[cfg(test)]
trait ReadExt: Read {
/// Pulls some bytes from this source into the specified buffer,
/// returning how many bytes were read.
Expand All @@ -608,6 +610,7 @@ pin_project! {

/// Tries to write some bytes from the given `buf` to the writer in an
/// asynchronous manner, returning a future.
#[cfg(test)]
fn write<'a, W>(writer: &'a mut W, buf: &'a [u8]) -> WriteFut<'a, W>
where
W: Write + Unpin + ?Sized,
Expand All @@ -627,6 +630,7 @@ where
}
}

#[cfg(test)]
trait WriteExt: Write {
/// Writes a buffer into this writer, returning how many bytes were
/// written.
Expand All @@ -638,6 +642,7 @@ trait WriteExt: Write {
}
}

#[cfg(test)]
impl<R> ReadExt for Pin<&mut TimeoutReader<R>>
where
R: Read,
Expand All @@ -647,6 +652,7 @@ where
}
}

#[cfg(test)]
impl<W> WriteExt for Pin<&mut TimeoutWriter<W>>
where
W: Write,
Expand All @@ -656,6 +662,7 @@ where
}
}

#[cfg(test)]
impl<S> ReadExt for Pin<&mut TimeoutStream<S>>
where
S: Read + Write,
Expand All @@ -665,6 +672,7 @@ where
}
}

#[cfg(test)]
impl<S> WriteExt for Pin<&mut TimeoutStream<S>>
where
S: Read + Write,
Expand Down

0 comments on commit 7346290

Please sign in to comment.