From f1f6c1286f24f6f762a9b195ac678b55d20c9a9b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Nov 2014 09:23:43 -0800 Subject: Rename unwrap functions to into_inner This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: https://github.com/rust-lang/rfcs/pull/430 [breaking-change] Closes #13159 cc #19091 --- src/libcore/cell.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index c4d0bec83ea..587bb4cb110 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -256,15 +256,19 @@ impl RefCell { } /// Consumes the `RefCell`, returning the wrapped value. - #[unstable = "may be renamed, depending on global conventions"] - pub fn unwrap(self) -> T { + #[unstable = "recently renamed per RFC 430"] + pub fn into_inner(self) -> T { // Since this function takes `self` (the `RefCell`) by value, the // compiler statically verifies that it is not currently borrowed. // Therefore the following assertion is just a `debug_assert!`. debug_assert!(self.borrow.get() == UNUSED); - unsafe{self.value.unwrap()} + unsafe { self.value.into_inner() } } + /// Deprecated, use into_inner() instead + #[deprecated = "renamed to into_inner()"] + pub fn unwrap(self) -> T { self.into_inner() } + /// Attempts to immutably borrow the wrapped value. /// /// The borrow lasts until the returned `Ref` exits scope. Multiple @@ -518,5 +522,9 @@ impl UnsafeCell { #[inline] #[unstable = "conventions around the name `unwrap` are still under \ development"] - pub unsafe fn unwrap(self) -> T { self.value } + pub unsafe fn into_inner(self) -> T { self.value } + + /// Deprecated, use into_inner() instead + #[deprecated = "renamed to into_inner()"] + pub unsafe fn unwrap(self) -> T { self.into_inner() } } -- cgit 1.4.1-3-g733a5