mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
4932d05733
Added new lint: `reserve_after_initialization` Closes https://github.com/rust-lang/rust-clippy/issues/11330. A new lint that informs the user about a more concise way to create a vector with a known capacity. Example: ```rust let mut v: Vec<usize> = vec![]; v.reserve(10); ``` Produces the following help: ```rust | 2 | / let mut v: Vec<usize> = vec![]; 3 | | v.reserve(10); | |__________________^ help: consider using `Vec::with_capacity(space_hint)`: `let v: Vec<usize> = Vec::with_capacity(10);` | ``` And can be rewritten as: ```rust let v: Vec<usize> = Vec::with_capacity(10); ``` changelog: new lint [`reserve_after_initialization`] |
||
---|---|---|
.. | ||
test_utils | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
workspace_test | ||
check-fmt.rs | ||
clippy.toml | ||
compile-test.rs | ||
dogfood.rs | ||
headers.rs | ||
integration.rs | ||
lint_message_convention.rs | ||
missing-test-files.rs | ||
versioncheck.rs | ||
workspace.rs |