diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-11-04 16:49:33 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-11-05 10:50:25 -0700 |
| commit | 5bce6ad16ad39468fdc4da91103f4fbe2d3233d7 (patch) | |
| tree | c24aa8912c2182fdf2a0cb6b250556a478a9341d | |
| parent | 78f18647e88fe65fe4f621a7feae1659dd6cb81c (diff) | |
| parent | 775d399da84776bfd8ae09af5f402874372e299c (diff) | |
| download | rust-5bce6ad16ad39468fdc4da91103f4fbe2d3233d7.tar.gz rust-5bce6ad16ad39468fdc4da91103f4fbe2d3233d7.zip | |
Rollup merge of #37587 - ollie27:to_mut, r=alexcrichton
Remove recursive call from Cow::to_mut It seems to prevent it from being inlined.
| -rw-r--r-- | src/libcollections/borrow.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 3bc2a3f8f68..37618b7600a 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -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, } |
