std: make .swap_remove return Option<T>.
This is one of the last raw "indexing" method on vectors that returns `T` instead of the Option.
This commit is contained in:
parent
3ca01676bc
commit
16e635cdfb
3 changed files with 35 additions and 27 deletions
|
|
@ -139,7 +139,7 @@ impl StackPool {
|
|||
pub fn take_stack(&mut self, min_size: uint) -> Stack {
|
||||
// Ideally this would be a binary search
|
||||
match self.stacks.iter().position(|s| min_size <= s.min_size) {
|
||||
Some(idx) => self.stacks.swap_remove(idx),
|
||||
Some(idx) => self.stacks.swap_remove(idx).unwrap(),
|
||||
None => Stack::new(min_size)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue