From 61e52866352339326600fe694e92373f2e07fd79 Mon Sep 17 00:00:00 2001 From: ksqsf Date: Fri, 2 Aug 2019 13:58:55 +0800 Subject: [PATCH] Remove Err variants of cloned and copied --- src/libcore/result.rs | 79 ------------------------------------------- 1 file changed, 79 deletions(-) diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 7b9f6d9ff8a6..935e48574fdf 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -860,46 +860,6 @@ impl Result<&mut T, E> { } } -impl Result { - /// Maps a `Result` to a `Result` by copying the contents of the - /// `Err` part. - /// - /// # Examples - /// - /// ``` - /// #![feature(result_copied)] - /// let val = 12; - /// let x: Result = Err(&val); - /// assert_eq!(x, Err(&12)); - /// let copied = x.copied_err(); - /// assert_eq!(copied, Err(12)); - /// ``` - #[unstable(feature = "result_copied", reason = "newly added", issue = "63168")] - pub fn copied_err(self) -> Result { - self.map_err(|&e| e) - } -} - -impl Result { - /// Maps a `Result` to a `Result` by copying the contents of the - /// `Err` part. - /// - /// # Examples - /// - /// ``` - /// #![feature(result_copied)] - /// let mut val = 12; - /// let x: Result = Err(&mut val); - /// assert_eq!(x, Err(&mut 12)); - /// let copied = x.copied_err(); - /// assert_eq!(copied, Err(12)); - /// ``` - #[unstable(feature = "result_copied", reason = "newly added", issue = "63168")] - pub fn copied_err(self) -> Result { - self.map_err(|&mut e| e) - } -} - impl Result<&T, E> { /// Maps a `Result<&T, E>` to a `Result` by cloning the contents of the /// `Ok` part. @@ -940,45 +900,6 @@ impl Result<&mut T, E> { } } -impl Result { - /// Maps a `Result` to a `Result` by cloning the contents of the - /// `Err` part. - /// - /// # Examples - /// - /// ``` - /// #![feature(result_cloned)] - /// let val = 12; - /// let x: Result = Err(&val); - /// assert_eq!(x, Err(&12)); - /// let cloned = x.cloned_err(); - /// assert_eq!(cloned, Err(12)); - /// ``` - #[unstable(feature = "result_cloned", reason = "newly added", issue = "63168")] - pub fn cloned_err(self) -> Result { - self.map_err(|e| e.clone()) - } -} - -impl Result { - /// Maps a `Result` to a `Result` by cloning the contents of the - /// `Err` part. - /// - /// # Examples - /// - /// ``` - /// #![feature(result_cloned)] - /// let mut val = 12; - /// let x: Result = Err(&mut val); - /// assert_eq!(x, Err(&mut 12)); - /// let cloned = x.cloned_err(); - /// assert_eq!(cloned, Err(12)); - /// ``` - #[unstable(feature = "result_cloned", reason = "newly added", issue = "63168")] - pub fn cloned_err(self) -> Result { - self.map_err(|e| e.clone()) - } -} impl Result { /// Unwraps a result, yielding the content of an [`Ok`].