This is what I have come up with so far (which also does a check check):
let index = xs.iter().position(|x| *x == some_x).unwrap(); xs.remove(index);
I'm still waiting to find a better way to do this, as it is pretty ugly.
Note: my code assumes the element exists (hence .unwrap() ).
source share