You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vec extend to append
This PR adds a check to suggest changes of vector from
```
vec.extend(other_vec.drain(..))
```
could be written as
```
vec![].append(&mut vec![]);
```
changelog: Add vec_extend_to_append lint
issue: #7209
Hey, I've noticed that this issue is still open after the implementation was merged in #7270. @Valentine-Mario here is a neat-trick for the next time: you can close issues when a PR is merged by including a closes #<id> in the PR description. (GitHub documentation for more keywords) 🙃
Hey, I've noticed that this issue is still open after the implementation was merged in #7270. @Valentine-Mario here is a neat-trick for the next time: you can close issues when a PR is merged by including a closes #<id> in the PR description. (GitHub documentation for more keywords)
What it does
This lint would suggest using the specialized
Vec::append
instead ofvec.extend(other_vec.drain(..))
.Categories (optional)
clippy::style
What is the advantage of the recommended code over the original code
append
even existing :)Drawbacks
None that I could come up with
Example
Could be written as:
The text was updated successfully, but these errors were encountered: