diff options
| author | John Arundel <john@bitfieldconsulting.com> | 2024-07-15 12:26:30 +0100 |
|---|---|---|
| committer | John Arundel <john@bitfieldconsulting.com> | 2024-07-26 13:26:33 +0100 |
| commit | a19472a93e2eecce1477011fa9f7ec49b45ca164 (patch) | |
| tree | 3b7cee954a0c37ee98fbedd430fbf46a2ea12559 /library/std/src/sync | |
| parent | 83d67685acb520fe68d5d5adde4b25fb725490de (diff) | |
| download | rust-a19472a93e2eecce1477011fa9f7ec49b45ca164.tar.gz rust-a19472a93e2eecce1477011fa9f7ec49b45ca164.zip | |
Fix doc nits
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
Diffstat (limited to 'library/std/src/sync')
| -rw-r--r-- | library/std/src/sync/lazy_lock.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sync/once_lock.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sync/poison.rs | 4 | ||||
| -rw-r--r-- | library/std/src/sync/rwlock.rs | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/library/std/src/sync/lazy_lock.rs b/library/std/src/sync/lazy_lock.rs index 18906aceffa..9fe9ccab4a9 100644 --- a/library/std/src/sync/lazy_lock.rs +++ b/library/std/src/sync/lazy_lock.rs @@ -175,7 +175,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> { } impl<T, F> LazyLock<T, F> { - /// Get the inner value if it has already been initialized. + /// Gets the inner value if it has already been initialized. fn get(&self) -> Option<&T> { if self.once.is_completed() { // SAFETY: diff --git a/library/std/src/sync/once_lock.rs b/library/std/src/sync/once_lock.rs index 94955beaf37..60e43a1cde1 100644 --- a/library/std/src/sync/once_lock.rs +++ b/library/std/src/sync/once_lock.rs @@ -578,7 +578,7 @@ impl<T: Clone> Clone for OnceLock<T> { #[stable(feature = "once_cell", since = "1.70.0")] impl<T> From<T> for OnceLock<T> { - /// Create a new cell with its contents set to `value`. + /// Creates a new cell with its contents set to `value`. /// /// # Example /// diff --git a/library/std/src/sync/poison.rs b/library/std/src/sync/poison.rs index f4975088b37..d71643b5000 100644 --- a/library/std/src/sync/poison.rs +++ b/library/std/src/sync/poison.rs @@ -31,13 +31,13 @@ impl Flag { } } - /// Check the flag for an unguarded borrow, where we only care about existing poison. + /// Checks the flag for an unguarded borrow, where we only care about existing poison. #[inline] pub fn borrow(&self) -> LockResult<()> { if self.get() { Err(PoisonError::new(())) } else { Ok(()) } } - /// Check the flag for a guarded borrow, where we may also set poison when `done`. + /// Checks the flag for a guarded borrow, where we may also set poison when `done`. #[inline] pub fn guard(&self) -> LockResult<Guard> { let ret = Guard { diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index a4ec52a4abe..d995a16e056 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -573,7 +573,7 @@ impl<T> From<T> for RwLock<T> { } impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> { - /// Create a new instance of `RwLockReadGuard<T>` from a `RwLock<T>`. + /// Creates a new instance of `RwLockReadGuard<T>` from a `RwLock<T>`. // SAFETY: if and only if `lock.inner.read()` (or `lock.inner.try_read()`) has been // successfully called from the same thread before instantiating this object. unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockReadGuard<'rwlock, T>> { @@ -585,7 +585,7 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> { } impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> { - /// Create a new instance of `RwLockWriteGuard<T>` from a `RwLock<T>`. + /// Creates a new instance of `RwLockWriteGuard<T>` from a `RwLock<T>`. // SAFETY: if and only if `lock.inner.write()` (or `lock.inner.try_write()`) has been // successfully called from the same thread before instantiating this object. unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockWriteGuard<'rwlock, T>> { |
