2 This lint catches reads into a zero-length `Vec`.
3 Especially in the case of a call to `with_capacity`, this lint warns that read
4 gets the number of bytes from the `Vec`'s length, not its capacity.
7 Reading zero bytes is almost certainly not the intended behavior.
10 In theory, a very unusual read implementation could assign some semantic meaning
11 to zero-byte reads. But it seems exceptionally unlikely that code intending to do
12 a zero-byte read would allocate a `Vec` for it.
17 fn foo<F: io::Read>(mut f: F) {
18 let mut data = Vec::with_capacity(100);
19 f.read(&mut data).unwrap();
25 fn foo<F: io::Read>(mut f: F) {
26 let mut data = Vec::with_capacity(100);
28 f.read(&mut data).unwrap();