Skip to content

Commit dc32916

Browse files
committed
Consolidate impl Option<&mut T>
1 parent 538fe4b commit dc32916

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

library/core/src/option.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ impl<T> Option<&T> {
17261726
}
17271727
}
17281728

1729-
impl<T: Copy> Option<&mut T> {
1729+
impl<T> Option<&mut T> {
17301730
/// Maps an `Option<&mut T>` to an `Option<T>` by copying the contents of the
17311731
/// option.
17321732
///
@@ -1742,15 +1742,16 @@ impl<T: Copy> Option<&mut T> {
17421742
#[must_use = "`self` will be dropped if the result is not used"]
17431743
#[stable(feature = "copied", since = "1.35.0")]
17441744
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
1745-
pub const fn copied(self) -> Option<T> {
1745+
pub const fn copied(self) -> Option<T>
1746+
where
1747+
T: Copy,
1748+
{
17461749
match self {
17471750
Some(&mut t) => Some(t),
17481751
None => None,
17491752
}
17501753
}
1751-
}
17521754

1753-
impl<T: Clone> Option<&mut T> {
17541755
/// Maps an `Option<&mut T>` to an `Option<T>` by cloning the contents of the
17551756
/// option.
17561757
///

0 commit comments

Comments
 (0)