about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/option.rs6
-rw-r--r--src/libcore/result.rs6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index ad0491f888c..e35c91206b8 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -455,6 +455,12 @@ impl<T> Option<T> {
     /// Applies a function to the contained value (if any),
     /// or returns the provided default (if not).
     ///
+    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing
+    /// the result of a function call, it is recommended to use [`map_or_else`],
+    /// which is lazily evaluated.
+    ///
+    /// [`map_or_else`]: #method.map_or_else
+    ///
     /// # Examples
     ///
     /// ```
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index bc70dbd62eb..809d4bace8e 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -524,6 +524,12 @@ impl<T, E> Result<T, E> {
     /// Applies a function to the contained value (if any),
     /// or returns the provided default (if not).
     ///
+    /// Arguments passed to `map_or` are eagerly evaluated; if you are passing
+    /// the result of a function call, it is recommended to use [`map_or_else`],
+    /// which is lazily evaluated.
+    ///
+    /// [`map_or_else`]: #method.map_or_else
+    ///
     /// # Examples
     ///
     /// ```