Skip to content

Commit

Permalink
Added documentation to remove_item
Browse files Browse the repository at this point in the history
  • Loading branch information
madseagames authored Feb 10, 2017
1 parent 8a02141 commit 37057e7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,18 @@ impl<T: PartialEq> Vec<T> {
pub fn dedup(&mut self) {
self.dedup_by(|a, b| a == b)
}


/// Removes the first instance of `item` from the vector if the item exists.
///
/// # Examples
///
/// ```
/// let mut vec = vec![1, 2, 3, 1];
///
/// vec.remove_item(&1);
///
/// assert_eq!(vec, vec![2, 3, 1]);

This comment has been minimized.

Copy link
@clarfonthey

clarfonthey Feb 10, 2017

Contributor

Minor style thing; could you remove the line breaks in the middle of the code?

/// ```
#[unstable(feature = "vec_remove_item", reason = "recently added", issue = "38143")]
pub fn remove_item(&mut self, item: &T) -> Option<T> {
let pos = match self.iter().position(|x| *x == *item) {
Expand Down

0 comments on commit 37057e7

Please sign in to comment.