Skip to content

Commit

Permalink
Rollup merge of rust-lang#37587 - ollie27:to_mut, r=alexcrichton
Browse files Browse the repository at this point in the history
Remove recursive call from Cow::to_mut

It seems to prevent it from being inlined.
  • Loading branch information
Jonathan Turner authored Nov 5, 2016
2 parents d687d1d + 775d399 commit c5a8dd3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
match *self {
Borrowed(borrowed) => {
*self = Owned(borrowed.to_owned());
self.to_mut()
match *self {
Borrowed(..) => unreachable!(),
Owned(ref mut owned) => owned,
}
}
Owned(ref mut owned) => owned,
}
Expand Down

0 comments on commit c5a8dd3

Please sign in to comment.