RS.CLIPPY.EXTEND_WITH_DRAIN
Using vec.append(&mut vec) to move the full range of a vector to another
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: extend_with_drain. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for occurrences where one vector gets extended instead of append
Why is this bad?
Using append instead of extend is more concise and faster
Example
let mut a = vec![1, 2, 3];
let mut b = vec![4, 5, 6];
a.extend(b.drain(..));
Use instead:
let mut a = vec![1, 2, 3];
let mut b = vec![4, 5, 6];
a.append(&mut b);