Sorting is not returning a vector

I just need to sort a vector, and It's returning '()', So I can't use the it, Here is the code:

sort_unstable modifies the given vector.
If you want to keep the unsorted one, clone it first, then sort that clone.

let mut vs = v.clone();
1 Like

I have the exact same error when I clone it.

Don't assign the result (there is none), just use the vector after you sort it in-place.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.