RS.CLIPPY.VEC_RESIZE_TO_ZERO

Emptying a vector with `resize(0, an_int)` instead of `clear()` is probably an argument inversion mistake

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: vec_resize_to_zero. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Finds occurrences of Vec::resize(0, an_int)

Why is this bad?

This is probably an argument inversion mistake.

Example

vec![1, 2, 3, 4, 5].resize(0, 5)

Use instead:

vec![1, 2, 3, 4, 5].clear()