about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHegui Dai <natural_selection_@outlook.com>2025-03-26 14:50:03 +0800
committerHegui Dai <natural_selection_@outlook.com>2025-03-26 14:50:03 +0800
commit159ae8fcee04302d24c9d1afc077697b8f266e11 (patch)
tree7ade1838e384a57a35f90bea399f74e744f5fcbe
parentfc126df5a7bf6cf74a8fcf16d2f8c2902c7d9e73 (diff)
downloadrust-159ae8fcee04302d24c9d1afc077697b8f266e11.tar.gz
rust-159ae8fcee04302d24c9d1afc077697b8f266e11.zip
Keeps the inspect() classification the same as in Result
-rw-r--r--library/core/src/option.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index ee755f6629e..a1f0224c779 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -171,6 +171,13 @@
 //! [`is_some_and`]: Option::is_some_and
 //! [`is_none_or`]: Option::is_none_or
 //!
+//! ## Inspecting the variant
+//!
+//! The [`inspect`] method takes ownership of the [`Option`]
+//! and applies the provided function to the contained value by reference if [`Some`]
+//!
+//! [`inspect`]: Option::inspect
+//!
 //! ## Adapters for working with references
 //!
 //! * [`as_ref`] converts from <code>[&][][Option]\<T></code> to <code>[Option]<[&]T></code>
@@ -248,8 +255,6 @@
 //!   if the function returns `true`; otherwise, returns [`None`]
 //! * [`flatten`] removes one level of nesting from an
 //!   [`Option<Option<T>>`]
-//! * [`insert`] calls the provided function with a reference to
-//!   the contained value if [`Some`]
 //! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the
 //!   provided function to the contained value of [`Some`] and leaving
 //!   [`None`] values unchanged
@@ -257,7 +262,6 @@
 //! [`Some(t)`]: Some
 //! [`filter`]: Option::filter
 //! [`flatten`]: Option::flatten
-//! [`insert`]: Option::insert
 //! [`map`]: Option::map
 //!
 //! These methods transform [`Option<T>`] to a value of a possibly