about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-18 22:56:58 +0800
committerGitHub <noreply@github.com>2024-12-18 22:56:58 +0800
commitfbb9e692262f5d218fba6fe4de69164183c4af5c (patch)
tree65447203e70b74510fb4552f422f8e28a5371e55
parent88428f4dc3a66e25d25ce4d69824c84a013db7ac (diff)
parent20bff638bf45990b7d71cdc330b4f68bd4b4bc73 (diff)
downloadrust-fbb9e692262f5d218fba6fe4de69164183c4af5c.tar.gz
rust-fbb9e692262f5d218fba6fe4de69164183c4af5c.zip
Rollup merge of #134452 - jalil-salame:fix-lazy-cell-docs, r=tgross35
fix(LazyCell): documentation of get[_mut] was wrong

- `LazyCell::get`: said it was returning a **mutable** reference.
- `LazyCell::get_mut`: said it was returning a reference (the mutable was missing).

Related to #129333 (`lazy_get`). `LazyLock`'s documentation was correct.
-rw-r--r--library/core/src/cell/lazy.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/cell/lazy.rs b/library/core/src/cell/lazy.rs
index 5ac33516684..84cbbc71f40 100644
--- a/library/core/src/cell/lazy.rs
+++ b/library/core/src/cell/lazy.rs
@@ -219,7 +219,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
 }
 
 impl<T, F> LazyCell<T, F> {
-    /// Returns a reference to the value if initialized, or `None` if not.
+    /// Returns a mutable reference to the value if initialized, or `None` if not.
     ///
     /// # Examples
     ///
@@ -245,7 +245,7 @@ impl<T, F> LazyCell<T, F> {
         }
     }
 
-    /// Returns a mutable reference to the value if initialized, or `None` if not.
+    /// Returns a reference to the value if initialized, or `None` if not.
     ///
     /// # Examples
     ///