Skip to content

Commit 10e6372

Browse files
committed
Stabilize result_option_inspect
1 parent 09df610 commit 10e6372

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

library/core/src/option.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,6 @@ impl<T> Option<T> {
10721072
/// # Examples
10731073
///
10741074
/// ```
1075-
/// #![feature(result_option_inspect)]
1076-
///
10771075
/// let v = vec![1, 2, 3, 4, 5];
10781076
///
10791077
/// // prints "got: 4"
@@ -1083,11 +1081,8 @@ impl<T> Option<T> {
10831081
/// let x: Option<&usize> = v.get(5).inspect(|x| println!("got: {x}"));
10841082
/// ```
10851083
#[inline]
1086-
#[unstable(feature = "result_option_inspect", issue = "91345")]
1087-
pub fn inspect<F>(self, f: F) -> Self
1088-
where
1089-
F: FnOnce(&T),
1090-
{
1084+
#[stable(feature = "result_option_inspect", since = "CURRENT_RUSTC_VERSION")]
1085+
pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self {
10911086
if let Some(ref x) = self {
10921087
f(x);
10931088
}

library/core/src/result.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -835,16 +835,14 @@ impl<T, E> Result<T, E> {
835835
/// # Examples
836836
///
837837
/// ```
838-
/// #![feature(result_option_inspect)]
839-
///
840838
/// let x: u8 = "4"
841839
/// .parse::<u8>()
842840
/// .inspect(|x| println!("original: {x}"))
843841
/// .map(|x| x.pow(3))
844842
/// .expect("failed to parse number");
845843
/// ```
846844
#[inline]
847-
#[unstable(feature = "result_option_inspect", issue = "91345")]
845+
#[stable(feature = "result_option_inspect", since = "CURRENT_RUSTC_VERSION")]
848846
pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self {
849847
if let Ok(ref t) = self {
850848
f(t);
@@ -858,8 +856,6 @@ impl<T, E> Result<T, E> {
858856
/// # Examples
859857
///
860858
/// ```
861-
/// #![feature(result_option_inspect)]
862-
///
863859
/// use std::{fs, io};
864860
///
865861
/// fn read() -> io::Result<String> {
@@ -868,7 +864,7 @@ impl<T, E> Result<T, E> {
868864
/// }
869865
/// ```
870866
#[inline]
871-
#[unstable(feature = "result_option_inspect", issue = "91345")]
867+
#[stable(feature = "result_option_inspect", since = "CURRENT_RUSTC_VERSION")]
872868
pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self {
873869
if let Err(ref e) = self {
874870
f(e);

0 commit comments

Comments
 (0)