Skip to content

Commit df67370

Browse files
Solved suggestions
1 parent e2bb87c commit df67370

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

core/src/option.rs

+11-17
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,18 @@
159159
//!
160160
//! ## Querying the variant
161161
//!
162-
//! The [`is_some`] and [`is_none`] methods take a borrow of the [`Option`]
162+
//! The [`is_some`] and [`is_none`] methods borrow of the [`Option`]
163163
//! and return [`true`] if the [`Option`] is [`Some`] or [`None`], respectively.
164164
//!
165-
//! The [`is_some_and`] and [`is_none_or`] methods take ownership of the [`Option`]
166-
//! and apply the provided function to make a decision.
167-
//! The methods return the same boolean value as the function returns.
165+
//! The [`is_some_and`] and [`is_none_or`] methods apply the provided function
166+
//! to the contents of the [`Option`] to produce a boolean value.
167+
//! If this is [`None`] then a default result is returned instead without executing the function.
168168
//!
169169
//! [`is_none`]: Option::is_none
170170
//! [`is_some`]: Option::is_some
171171
//! [`is_some_and`]: Option::is_some_and
172172
//! [`is_none_or`]: Option::is_none_or
173173
//!
174-
//! ## Inspecting the variant
175-
//!
176-
//! The [`inspect`] method takes ownership of the [`Option`]
177-
//! and applies the provided function to the contained value by reference if [`Some`]
178-
//!
179-
//! [`inspect`]: Option::inspect
180-
//!
181174
//! ## Adapters for working with references
182175
//!
183176
//! * [`as_ref`] converts from <code>[&][][Option]\<T></code> to <code>[Option]<[&]T></code>
@@ -190,9 +183,9 @@
190183
//! <code>[Option]<[Pin]<[&]T>></code>
191184
//! * [`as_pin_mut`] converts from <code>[Pin]<[&mut] [Option]\<T>></code> to
192185
//! <code>[Option]<[Pin]<[&mut] T>></code>
193-
//! * [`as_slice`] returns a slice of the contained value, if any.
186+
//! * [`as_slice`] returns a one-element slice of the contained value, if any.
194187
//! If this is [`None`], an empty slice is returned.
195-
//! * [`as_mut_slice`] returns a mutable slice of the contained value, if any.
188+
//! * [`as_mut_slice`] returns a mutable one-element slice of the contained value, if any.
196189
//! If this is [`None`], an empty slice is returned.
197190
//!
198191
//! [&]: reference "shared reference"
@@ -219,8 +212,7 @@
219212
//! (which must implement the [`Default`] trait)
220213
//! * [`unwrap_or_else`] returns the result of evaluating the provided
221214
//! function
222-
//! * [`unwrap_unchecked`] returns the contained value, without checking
223-
//! calling this method on None is *[undefined behavior]*
215+
//! * [`unwrap_unchecked`] produces *[undefined behavior]*
224216
//!
225217
//! [`expect`]: Option::expect
226218
//! [`unwrap`]: Option::unwrap
@@ -253,15 +245,17 @@
253245
//! * [`filter`] calls the provided predicate function on the contained
254246
//! value `t` if the [`Option`] is [`Some(t)`], and returns [`Some(t)`]
255247
//! if the function returns `true`; otherwise, returns [`None`]
256-
//! * [`flatten`] removes one level of nesting from an
257-
//! [`Option<Option<T>>`]
248+
//! * [`flatten`] removes one level of nesting from an [`Option<Option<T>>`]
249+
//! * [`inspect`] method takes ownership of the [`Option`] and applies
250+
//! the provided function to the contained value by reference if [`Some`]
258251
//! * [`map`] transforms [`Option<T>`] to [`Option<U>`] by applying the
259252
//! provided function to the contained value of [`Some`] and leaving
260253
//! [`None`] values unchanged
261254
//!
262255
//! [`Some(t)`]: Some
263256
//! [`filter`]: Option::filter
264257
//! [`flatten`]: Option::flatten
258+
//! [`inspect`]: Option::inspect
265259
//! [`map`]: Option::map
266260
//!
267261
//! These methods transform [`Option<T>`] to a value of a possibly

0 commit comments

Comments
 (0)