From: Oliver Middleton Date: Fri, 4 Nov 2016 18:47:32 +0000 (+0000) Subject: Remove recursive call from Cow::to_mut X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=775d399da84776bfd8ae09af5f402874372e299c;p=rust.git Remove recursive call from Cow::to_mut It seems to prevent it from being inlined. --- diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 8f9c3578337..30286fb243c 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -159,7 +159,10 @@ pub fn to_mut(&mut self) -> &mut ::Owned { 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, }