drain-collect Disallow draining a collection only to collect the same elements again Draining an entire collection and collecting it into the same representation allocates replacement storage. Instead, you SHOULD call take to move out the existing collection and leave its default value. take transfers the existing allocation to the returned collection, so the emptied source no longer retains its capacity. - Category: performance - Level: warning - Fix: none - Scope: module Reported function removeAll(values: &exclusive int32[]): int32[] { return values.drain().toArray(); } Accepted import { take } from "destack:memory"; function removeAll(values: &exclusive int32[]): int32[] { return take(values); } Prior art - Clippy ยท draincollect language/linter/src/rules/performance/draincollect.rs:6