Skip to content

Commit 34b42f4

Browse files
committed
modify description
1 parent 1776977 commit 34b42f4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

clippy_lints/src/read_zero_byte_vec.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,20 @@ declare_clippy_lint! {
2626
///
2727
/// ### Example
2828
/// ```rust
29-
/// let mut data = Vec::with_capacity(len);
30-
/// r.read_exact(&mut data)?;
29+
/// use std::io;
30+
/// fn foo<F: io::Read>(mut f: F) {
31+
/// let mut data = Vec::with_capacity(100);
32+
/// f.read(&mut data).unwrap();
33+
/// }
3134
/// ```
3235
/// Use instead:
3336
/// ```rust
34-
/// let mut data = Vec::with_capacity(len);
35-
/// data.resize(len, 0);
36-
/// r.read_exact(&mut data)?;
37+
/// use std::io;
38+
/// fn foo<F: io::Read>(mut f: F) {
39+
/// let mut data = Vec::with_capacity(100);
40+
/// data.resize(100, 0);
41+
/// f.read(&mut data).unwrap();
42+
/// }
3743
/// ```
3844
#[clippy::version = "1.63.0"]
3945
pub READ_ZERO_BYTE_VEC,

0 commit comments

Comments
 (0)