We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fe208b commit 3304e00Copy full SHA for 3304e00
src/libcollections/vec.rs
@@ -1298,14 +1298,13 @@ impl<T: PartialEq> Vec<T> {
1298
}
1299
1300
#[unstable(feature = "vec_remove_item", reason = "recently added", issue = "38143")]
1301
- pub fn remove_item(&mut self, item: &T) -> Option<usize> {
+ pub fn remove_item(&mut self, item: &T) -> Option<(usize, T)> {
1302
let pos = match self.iter().position(|x| *x == *item) {
1303
Some(x) => x,
1304
None => return None,
1305
};
1306
1307
- self.remove(pos);
1308
- Some(pos)
+ Some((pos, self.remove(pos)))
1309
1310
1311
0 commit comments