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
alexcrichton authored Nov 4, 2016
2 parents 835cb4b + 775d399 commit efc1796
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 efc1796

Please sign in to comment.