Add a warning about Option/Result::and()
being eagerly evaluated
Copied from `or()`.
This commit is contained in:
parent
ee8c31e64d
commit
eb2fdd917e
2 changed files with 11 additions and 0 deletions
|
@ -1189,6 +1189,12 @@ impl<T> Option<T> {
|
|||
|
||||
/// Returns [`None`] if the option is [`None`], otherwise returns `optb`.
|
||||
///
|
||||
/// Arguments passed to `and` are eagerly evaluated; if you are passing the
|
||||
/// result of a function call, it is recommended to use [`and_then`], which is
|
||||
/// lazily evaluated.
|
||||
///
|
||||
/// [`and_then`]: Option::and_then
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue