zero_len_vec_used
for iterating, using vec.len()
, or slicing after Vec::with_capacity
#14146
Labels
A-lint
Area: New lints
What it does
Checks for empty
Vec
s and usage that requires it to be non-empty to make sense.Similar to
read_zero_byte_vec
, but more general.Advantage
Vec::with_capacity
(orVec::new()
,Vec::default()
,vec![]
) and tries to incorrectly use it as if it was filled.Drawbacks
Example
Could be written as:
The text was updated successfully, but these errors were encountered: