-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Open
Description
In this part of code clippy error message not inline with the intent.
rustlings/exercises/22_clippy/clippy3.rs
Lines 20 to 21 in fbfd4f2
let my_empty_vec = vec![1, 2, 3, 4, 5].resize(0, 5); | |
println!("This Vec is empty, see? {my_empty_vec:?}"); |
Because the solution stated that this is about using clear
instead of resize
.
rustlings/solutions/22_clippy/clippy3.rs
Lines 20 to 23 in fbfd4f2
let mut my_empty_vec = vec![1, 2, 3, 4, 5]; | |
// `resize` mutates a vector instead of returning a new one. | |
// `resize(0, …)` clears a vector, so it is better to use `clear`. | |
my_empty_vec.clear(); |
elasticspoon
Metadata
Metadata
Assignees
Labels
No labels