Skip to content

Commit

Permalink
Remove recursive call from Cow::to_mut
Browse files Browse the repository at this point in the history
It seems to prevent it from being inlined.
  • Loading branch information
ollie27 committed Nov 4, 2016
1 parent acfe959 commit 775d399
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 @@ -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,
}
Expand Down

0 comments on commit 775d399

Please sign in to comment.