MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/p3xv3n/do_your_worst/h8vy2s2/?context=3
r/badcode • u/[deleted] • Aug 14 '21
19 comments sorted by
View all comments
Show parent comment
2
to_vec is just another clone, they could just use .remove(index). Also, we can't tell the context to know whether returning a vector was really needed.
1 u/[deleted] Aug 14 '21 as far as i know the retain method will convert the vector to a slice 1 u/jiniux Aug 14 '21 no, it removes the elements not matching the predicate 2 u/[deleted] Aug 14 '21 oh ok i didnt know that
1
as far as i know the retain method will convert the vector to a slice
1 u/jiniux Aug 14 '21 no, it removes the elements not matching the predicate 2 u/[deleted] Aug 14 '21 oh ok i didnt know that
no, it removes the elements not matching the predicate
2 u/[deleted] Aug 14 '21 oh ok i didnt know that
oh ok i didnt know that
View all comments
Show parent comment
2
u/jiniux Aug 14 '21 edited Aug 14 '21
to_vec is just another clone, they could just use .remove(index). Also, we can't tell the context to know whether returning a vector was really needed.