File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -26,14 +26,20 @@ declare_clippy_lint! {
26
26
///
27
27
/// ### Example
28
28
/// ```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
+ /// }
31
34
/// ```
32
35
/// Use instead:
33
36
/// ```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
+ /// }
37
43
/// ```
38
44
#[ clippy:: version = "1.63.0" ]
39
45
pub READ_ZERO_BYTE_VEC ,
You can’t perform that action at this time.
0 commit comments