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 e507fe4 commit 87099a6
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 @@ -574,6 +574,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 @@ -595,6 +596,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 @@ -616,6 +618,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 @@ -635,6 +638,7 @@ where
}
}

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

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

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

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

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

0 comments on commit 87099a6

Please sign in to comment.