Skip to content

Commit c5a8dd3

Browse files
author
Jonathan Turner
authored
Rollup merge of #37587 - ollie27:to_mut, r=alexcrichton
Remove recursive call from Cow::to_mut It seems to prevent it from being inlined.
2 parents d687d1d + 775d399 commit c5a8dd3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcollections/borrow.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
160160
match *self {
161161
Borrowed(borrowed) => {
162162
*self = Owned(borrowed.to_owned());
163-
self.to_mut()
163+
match *self {
164+
Borrowed(..) => unreachable!(),
165+
Owned(ref mut owned) => owned,
166+
}
164167
}
165168
Owned(ref mut owned) => owned,
166169
}

0 commit comments

Comments
 (0)