Skip to content

Commit 2fd0804

Browse files
committed
Add performance note when using IoRead
- nightly clippy has an inefficient warning when using un-buffered io::Read::bytes(). clippy::unbuffered_bytes is the lint name.
1 parent 601bcaa commit 2fd0804

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/read.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ where
146146
R: io::Read,
147147
{
148148
/// Instantiates a new reader.
149+
///
150+
/// # Performance
151+
///
152+
/// It is strongly recommended to use a [BufReader][std::io::BufReader] or a
153+
/// similar type (which buffers read data in-memory) as the `reader`
154+
/// argument. See `BufReader`'s documentation for more information.
149155
pub fn new(reader: R) -> Self {
150156
IoRead {
151157
iter: reader.bytes(),

0 commit comments

Comments
 (0)