Remove as_deref_err and as_deref_mut_err from Result

This commit is contained in:
Lzu Tao 2020-07-30 15:32:00 +00:00
parent c058a8b8dc
commit 07575286b8
5 changed files with 0 additions and 59 deletions

View File

@ -1169,16 +1169,6 @@ impl<T: Deref, E> Result<T, E> {
}
}
#[unstable(feature = "inner_deref", issue = "50264")]
impl<T, E: Deref> Result<T, E> {
/// Converts from `Result<T, E>` (or `&Result<T, E>`) to `Result<&T, &<E as Deref>::Target>`.
///
/// Coerces the [`Err`] variant of the original [`Result`] via [`Deref`](crate::ops::Deref)
/// and returns the new [`Result`].
pub fn as_deref_err(&self) -> Result<&T, &E::Target> {
self.as_ref().map_err(|e| e.deref())
}
}
#[unstable(feature = "inner_deref", issue = "50264")]
impl<T: DerefMut, E> Result<T, E> {
@ -1206,17 +1196,6 @@ impl<T: DerefMut, E> Result<T, E> {
}
}
#[unstable(feature = "inner_deref", issue = "50264")]
impl<T, E: DerefMut> Result<T, E> {
/// Converts from `Result<T, E>` (or `&mut Result<T, E>`) to `Result<&mut T, &mut <E as DerefMut>::Target>`.
///
/// Coerces the [`Err`] variant of the original [`Result`] via [`DerefMut`](crate::ops::DerefMut)
/// and returns the new [`Result`].
pub fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> {
self.as_mut().map_err(|e| e.deref_mut())
}
}
impl<T, E> Result<Option<T>, E> {
/// Transposes a `Result` of an `Option` into an `Option` of a `Result`.
///

View File

@ -1,6 +0,0 @@
#![feature(inner_deref)]
fn main() {
let _result = &Err(41).as_deref_err();
//~^ ERROR no method named `as_deref_err` found
}

View File

@ -1,13 +0,0 @@
error[E0599]: no method named `as_deref_err` found for enum `std::result::Result<_, {integer}>` in the current scope
--> $DIR/result-as_deref_err.rs:4:28
|
LL | let _result = &Err(41).as_deref_err();
| ^^^^^^^^^^^^ help: there is an associated function with a similar name: `as_deref_mut`
|
= note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
`{integer}: std::ops::Deref`
`<{integer} as std::ops::Deref>::Target = _`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.

View File

@ -1,6 +0,0 @@
#![feature(inner_deref)]
fn main() {
let _result = &mut Err(41).as_deref_mut_err();
//~^ ERROR no method named `as_deref_mut_err` found
}

View File

@ -1,13 +0,0 @@
error[E0599]: no method named `as_deref_mut_err` found for enum `std::result::Result<_, {integer}>` in the current scope
--> $DIR/result-as_deref_mut_err.rs:4:32
|
LL | let _result = &mut Err(41).as_deref_mut_err();
| ^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `as_deref_mut`
|
= note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
`{integer}: std::ops::DerefMut`
`<{integer} as std::ops::Deref>::Target = _`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.