about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 93a51ccb207..0825dc228d8 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -1688,6 +1688,9 @@ impl<T: PartialEq> Vec<T> {
     pub fn dedup(&mut self) {
         self.dedup_by(|a, b| a == b)
     }
+}
+
+impl <T> Vec<T> {
 
     /// Removes the first instance of `item` from the vector if the item exists.
     ///
@@ -1701,11 +1704,15 @@ impl<T: PartialEq> Vec<T> {
     ///
     /// assert_eq!(vec, vec![2, 3, 1]);
     /// ```
+
     #[unstable(feature = "vec_remove_item", reason = "recently added", issue = "40062")]
-    pub fn remove_item(&mut self, item: &T) -> Option<T> {
+    pub fn remove_item<V>(&mut self, item: &V) -> Option<T>
+    where T: PartialEq<V>
+    {
         let pos = self.iter().position(|x| *x == *item)?;
         Some(self.remove(pos))
     }
+
 }
 
 ////////////////////////////////////////////////////////////////////////////////