about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-23 12:06:41 +0000
committerbors <bors@rust-lang.org>2023-08-23 12:06:41 +0000
commit4932d0573360bb71d078579842d7b7712edff1a3 (patch)
treea71b8b37a5dd9e1e7f73b8df8c17ad145b7d5d27 /compiler/rustc_interface/src/errors.rs
parentedfee16ade1d4af7fa33e34e39ff443cbdd7ffe9 (diff)
parentf3c58773026bf042142be2bf8ed1e8b8797a4f68 (diff)
downloadrust-4932d0573360bb71d078579842d7b7712edff1a3.tar.gz
rust-4932d0573360bb71d078579842d7b7712edff1a3.zip
Auto merge of #11373 - Red-Rapious:master, r=blyxyas,y21
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`]
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions