Rollup merge of #37587 - ollie27:to_mut, r=alexcrichton

Remove recursive call from Cow::to_mut

It seems to prevent it from being inlined.
This commit is contained in:
Alex Crichton 2016-11-04 16:49:33 -07:00
commit 5bce6ad16a

View File

@ -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,
}