auto merge of #19149 : alexcrichton/rust/issue-19091, r=aturon
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] cc #19091
This commit is contained in:
commit
f6cb58caee
14 changed files with 84 additions and 24 deletions
|
|
@ -1248,7 +1248,7 @@ pub struct MoveItems<T> {
|
|||
impl<T> MoveItems<T> {
|
||||
#[inline]
|
||||
/// Drops all items that have not yet been moved and returns the empty vector.
|
||||
pub fn unwrap(mut self) -> Vec<T> {
|
||||
pub fn into_inner(mut self) -> Vec<T> {
|
||||
unsafe {
|
||||
for _x in self { }
|
||||
let MoveItems { allocation, cap, ptr: _ptr, end: _end } = self;
|
||||
|
|
@ -1256,6 +1256,10 @@ impl<T> MoveItems<T> {
|
|||
Vec { ptr: allocation, cap: cap, len: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
/// Deprecated, use into_inner() instead
|
||||
#[deprecated = "renamed to into_inner()"]
|
||||
pub fn unwrap(self) -> Vec<T> { self.into_inner() }
|
||||
}
|
||||
|
||||
impl<T> Iterator<T> for MoveItems<T> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue