prefer-with-capacity Prefer withCapacity over immediate reservation after construction Constructing an empty collection and immediately reserving capacity splits one initialization across two operations. Instead, you SHOULD construct the collection with withCapacity. - Category: performance - Level: warning - Fix: suggestion - Scope: module Reported function collect(capacity: usize): ^int32[] { let values: ^int32[] = Array.new(); values.reserve(capacity); return values; } Accepted function collect(capacity: usize): ^int32[] { let values: ^int32[] = Array.withCapacity(capacity); return values; } Prior art - Clippy ยท reserveafterinitialization language/linter/src/rules/performance/preferwithcapacity.rs:25