Skip to content

Commit

Permalink
Rollup merge of rust-lang#41019 - mandeep:fix-vec-swapremove-docs, r=…
Browse files Browse the repository at this point in the history
…BurntSushi

Fixed typo in doc comments for swap_remove

While reading the Vec docs, I came across the docs for swap_remove. I believe there is a typo in the comment and ```return``` should be ```returns```. This PR fixes this issue.

I also feel that the entire doc comment is a bit of a run-on and could be changed to something along the lines of ```Removes an element from anywhere in the vector and returns it. The vector is mutated and the removed element is replaced by the last element of the vector. ```

Thoughts?
  • Loading branch information
frewsxcv committed Apr 3, 2017
2 parents f22cc07 + f74ca38 commit c303fe0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,9 @@ impl<T> Vec<T> {
self.len = len;
}

/// Removes an element from anywhere in the vector and return it, replacing
/// it with the last element.
/// Removes an element from the vector and returns it.
///
/// The removed element is replaced by the last element of the vector.
///
/// This does not preserve ordering, but is O(1).
///
Expand Down

0 comments on commit c303fe0

Please sign in to comment.