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
This commit is contained in:
John Arundel
2024-07-15 12:26:30 +01:00
parent 83d67685ac
commit a19472a93e
146 changed files with 808 additions and 738 deletions

View File

@@ -13,7 +13,7 @@ pub struct Mutex {
mtx: SpinIdOnceCell<()>,
}
/// Create a mutex object. This function never panics.
/// Creates a mutex object. This function never panics.
fn new_mtx() -> Result<abi::ID, ItronError> {
ItronError::err_if_negative(unsafe {
abi::acre_mtx(&abi::T_CMTX {
@@ -31,7 +31,7 @@ impl Mutex {
Mutex { mtx: SpinIdOnceCell::new() }
}
/// Get the inner mutex's ID, which is lazily created.
/// Gets the inner mutex's ID, which is lazily created.
fn raw(&self) -> abi::ID {
match self.mtx.get_or_try_init(|| new_mtx().map(|id| (id, ()))) {
Ok((id, ())) => id,

View File

@@ -222,7 +222,7 @@ impl RwLock {
}
}
/// Wake up waiting threads after unlocking.
/// Wakes up waiting threads after unlocking.
///
/// If both are waiting, this will wake up only one writer, but will fall
/// back to waking up readers if there was no writer to wake up.

View File

@@ -186,7 +186,7 @@ struct Node {
}
impl Node {
/// Create a new queue node.
/// Creates a new queue node.
fn new(write: bool) -> Node {
Node {
next: AtomicLink::new(None),

View File

@@ -28,7 +28,7 @@ impl RwLock {
RwLock { rwl: SpinIdOnceCell::new() }
}
/// Get the inner mutex's ID, which is lazily created.
/// Gets the inner mutex's ID, which is lazily created.
fn raw(&self) -> abi::ID {
match self.rwl.get_or_try_init(|| new_rwl().map(|id| (id, ()))) {
Ok((id, ())) => id,

View File

@@ -36,7 +36,7 @@ pub struct Parker {
// Ordering::Release when writing NOTIFIED (the 'token') in unpark(), and using
// Ordering::Acquire when checking for this state in park().
impl Parker {
/// Construct the futex parker. The UNIX parker implementation
/// Constructs the futex parker. The UNIX parker implementation
/// requires this to happen in-place.
pub unsafe fn new_in_place(parker: *mut Parker) {
unsafe { parker.write(Self { state: Atomic::new(EMPTY) }) };

View File

@@ -30,7 +30,7 @@ impl Parker {
Parker { state: AtomicI8::new(EMPTY), tid: UnsafeCell::new(None) }
}
/// Create a new thread parker. UNIX requires this to happen in-place.
/// Creates a new thread parker. UNIX requires this to happen in-place.
pub unsafe fn new_in_place(parker: *mut Parker) {
parker.write(Parker::new())
}

View File

@@ -92,7 +92,7 @@ pub struct Parker {
}
impl Parker {
/// Construct the UNIX parker in-place.
/// Constructs the UNIX parker in-place.
///
/// # Safety
/// The constructed parker must never be moved.

View File

@@ -95,7 +95,7 @@ const NOTIFIED: i8 = 1;
// Ordering::Release when writing NOTIFIED (the 'token') in unpark(), and using
// Ordering::Acquire when reading this state in park() after waking up.
impl Parker {
/// Construct the Windows parker. The UNIX parker implementation
/// Constructs the Windows parker. The UNIX parker implementation
/// requires this to happen in-place.
pub unsafe fn new_in_place(parker: *mut Parker) {
parker.write(Self { state: AtomicI8::new(EMPTY) });