Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReport usages of &Vec<T> in function arguments #7640
Closed
Labels
Comments
|
I think I can do it. |
|
Great! |
|
I'm new to Rust so I just need some clarification. I thought that vectors allow for adding and removing elements whereas arrays do not. A function needing to manipulate a collection parameter's items would need the parameter to be a vector, no? |
|
Those would need to be mutable, ie. &mut Vec. Immutable references provide no additional functionality over slices. |
|
Oh right. thanks for the help! |
|
It seems clippy has this lint |
bors-servo
pushed a commit
that referenced
this issue
Sep 27, 2015
Check for Extra pointer dereferencing Solves issue #7640 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7643) <!-- Reviewable:end -->
bors-servo
pushed a commit
that referenced
this issue
Sep 27, 2015
Check for Extra pointer dereferencing Solves issue #7640 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7643) <!-- Reviewable:end -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's no reason for a function to accept a
&Vec<T>argument instead of&[T], since they allow the same operations and the first is an extra pointer dereference. We should check for the string: &Vec<in Rust source files and report any instances found.Code: python/tidy.py