about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2021-12-30 10:37:50 -0800
committerDavid Tolnay <dtolnay@gmail.com>2021-12-30 10:37:53 -0800
commitdc3291614a7e72b833dcae870f8c9b12ede15549 (patch)
tree050f982ad094ec9ebcf4bb5ca3600402546aa265
parent538fe4b28d3aca5657a95aadf65800d2237276d1 (diff)
downloadrust-dc3291614a7e72b833dcae870f8c9b12ede15549.tar.gz
rust-dc3291614a7e72b833dcae870f8c9b12ede15549.zip
Consolidate impl Option<&mut T>
-rw-r--r--library/core/src/option.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 9b3b27b68a3..0022df4f65f 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -1726,7 +1726,7 @@ impl<T> Option<&T> {
     }
 }
 
-impl<T: Copy> Option<&mut T> {
+impl<T> Option<&mut T> {
     /// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the
     /// option.
     ///
@@ -1742,15 +1742,16 @@ impl<T: Copy> Option<&mut T> {
     #[must_use = "`self` will be dropped if the result is not used"]
     #[stable(feature = "copied", since = "1.35.0")]
     #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
-    pub const fn copied(self) -> Option<T> {
+    pub const fn copied(self) -> Option<T>
+    where
+        T: Copy,
+    {
         match self {
             Some(&mut t) => Some(t),
             None => None,
         }
     }
-}
 
-impl<T: Clone> Option<&mut T> {
     /// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the
     /// option.
     ///