mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-24 07:21:05 +02:00
Vec::new()
doesn't allocate (#2026)
So remove it from the list of things to look on that allocate, and replace with `vec![]`, which does allocate (if given any elements).
This commit is contained in:
parent
402ac3a202
commit
5633dd52a7
@ -22,7 +22,7 @@ fn main() {
|
||||
<details>
|
||||
|
||||
- The idea of `Clone` is to make it easy to spot where heap allocations are
|
||||
occurring. Look for `.clone()` and a few others like `Vec::new` or `Box::new`.
|
||||
occurring. Look for `.clone()` and a few others like `vec!` or `Box::new`.
|
||||
|
||||
- It's common to "clone your way out" of problems with the borrow checker, and
|
||||
return later to try to optimize those clones away.
|
||||
|
Loading…
x
Reference in New Issue
Block a user