Skip to content

Commit f8f2330

Browse files
Solved suggestions
1 parent 13303a5 commit f8f2330

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

library/core/src/result.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -256,27 +256,18 @@
256256
//!
257257
//! ## Querying the variant
258258
//!
259-
//! The [`is_ok`] and [`is_err`] methods take the borrow of the [`Result`]
259+
//! The [`is_ok`] and [`is_err`] methods borrow of the [`Result`]
260260
//! and return [`true`] if the [`Result`] is [`Ok`] or [`Err`], respectively.
261261
//!
262-
//! The [`is_ok_and`] and [`is_err_and`] methods take ownership of the [`Result`]
263-
//! and apply the provided function to make a decision.
264-
//! The methods return the same boolean value as the function returns.
262+
//! The [`is_ok_and`] and [`is_err_and`] methods apply the provided function
263+
//! to the contents of the [`Result`] to produce a boolean value. If this is [`Err`]
264+
//! then a default result is returned instead without executing the function.
265265
//!
266266
//! [`is_err`]: Result::is_err
267267
//! [`is_ok`]: Result::is_ok
268268
//! [`is_ok_and`]: Result::is_ok_and
269269
//! [`is_err_and`]: Result::is_err_and
270270
//!
271-
//! ## Inspecting the variant
272-
//!
273-
//! The [`inspect`] and [`inspect_err`] methods take ownership of the [`Result`]
274-
//! and apply the provided function to the contained value by reference if [`Ok`]
275-
//! or [`Err`], respectively. And then, the [`Result`] is returned.
276-
//!
277-
//! [`inspect`]: Result::inspect
278-
//! [`inspect_err`]: Result::inspect_err
279-
//!
280271
//! ## Adapters for working with references
281272
//!
282273
//! * [`as_ref`] converts from `&Result<T, E>` to `Result<&T, &E>`
@@ -302,7 +293,7 @@
302293
//! (which must implement the [`Default`] trait)
303294
//! * [`unwrap_or_else`] returns the result of evaluating the provided
304295
//! function
305-
//! * [`unwrap_unchecked`] is *[undefined behavior]*
296+
//! * [`unwrap_unchecked`] produces *[undefined behavior]*
306297
//!
307298
//! The panicking methods [`expect`] and [`unwrap`] require `E` to
308299
//! implement the [`Debug`] trait.
@@ -322,7 +313,7 @@
322313
//!
323314
//! * [`expect_err`] panics with a provided custom message
324315
//! * [`unwrap_err`] panics with a generic message
325-
//! * [`unwrap_err_unchecked`] is *[undefined behavior]*
316+
//! * [`unwrap_err_unchecked`] produces *[undefined behavior]*
326317
//!
327318
//! [`Debug`]: crate::fmt::Debug
328319
//! [`expect_err`]: Result::expect_err
@@ -356,16 +347,24 @@
356347
//! * [`map`] transforms [`Result<T, E>`] into [`Result<U, E>`] by applying
357348
//! the provided function to the contained value of [`Ok`] and leaving
358349
//! [`Err`] values unchanged
350+
//! * [`inspect`] takes ownership of the [`Result`] and applies the
351+
//! provided function to the contained value by reference,
352+
//! and then the [`Result`] is returned
359353
//!
360354
//! [`map`]: Result::map
355+
//! [`inspect`]: Result::inspect
361356
//!
362357
//! This method transforms the contained value of the [`Err`] variant:
363358
//!
364359
//! * [`map_err`] transforms [`Result<T, E>`] into [`Result<T, F>`] by
365360
//! applying the provided function to the contained value of [`Err`] and
366361
//! leaving [`Ok`] values unchanged
362+
//! * [`inspect_err`] takes ownership of the [`Result`] and applies the
363+
//! provided function to the contained value of [`Err`] by reference,
364+
//! and then the [`Result`] is returned
367365
//!
368366
//! [`map_err`]: Result::map_err
367+
//! [`inspect_err`]: Result::inspect_err
369368
//!
370369
//! These methods transform a [`Result<T, E>`] into a value of a possibly
371370
//! different type `U`:

0 commit comments

Comments
 (0)