diff options
| author | mbartlett21 <29034492+mbartlett21@users.noreply.github.com> | 2021-11-10 09:05:15 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-10 09:05:15 +1000 |
| commit | 8b81937f9a98e413518829ca7793f341e22c2be1 (patch) | |
| tree | 178ebccea0c8a772049f9704274369e097593af8 | |
| parent | 9de2745c95e4855e1f696b5aa40869b93bd35ad9 (diff) | |
| download | rust-8b81937f9a98e413518829ca7793f341e22c2be1.tar.gz rust-8b81937f9a98e413518829ca7793f341e22c2be1.zip | |
Format
| -rw-r--r-- | library/core/src/option.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 261ff4403c9..dd36e95323e 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1498,7 +1498,10 @@ impl<T: Clone> Option<&T> { #[must_use = "`self` will be dropped if the result is not used"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_option_cloned", issue = "none")] - pub const fn cloned(self) -> Option<T> where T: ~const Clone { + pub const fn cloned(self) -> Option<T> + where + T: ~const Clone, + { match self { Some(t) => Some(t.clone()), None => None, @@ -1522,7 +1525,10 @@ impl<T: Clone> Option<&mut T> { #[must_use = "`self` will be dropped if the result is not used"] #[stable(since = "1.26.0", feature = "option_ref_mut_cloned")] #[rustc_const_unstable(feature = "const_option_cloned", issue = "none")] - pub const fn cloned(self) -> Option<T> where T: ~const Clone { + pub const fn cloned(self) -> Option<T> + where + T: ~const Clone, + { match self { Some(t) => Some(t.clone()), None => None, |
