Remove recursive call from Cow::to_mut

It seems to prevent it from being inlined.
This commit is contained in:
Oliver Middleton 2016-11-04 18:47:32 +00:00
parent acfe959701
commit 775d399da8

View File

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