Skip to content

Commit a3c3398

Browse files
authored
Miscellaneous documentation cleanups. (#863)
1 parent ed91e1f commit a3c3398

39 files changed

Lines changed: 138 additions & 135 deletions

src/backend/libc/c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ mod readwrite_pv64 {
329329
#[cfg(target_os = "android")]
330330
pub(super) use readwrite_pv64::{preadv64 as preadv, pwritev64 as pwritev};
331331

332-
// macOS added preadv and pwritev in version 11.0
332+
// macOS added `preadv` and `pwritev` in version 11.0.
333333
#[cfg(apple)]
334334
mod readwrite_pv {
335335
weakcall! {

src/backend/libc/event/epoll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ pub struct Event {
312312
pub data: EventData,
313313
}
314314

315-
/// Data assocated with an [`Event`]. This can either be a 64-bit integer value
316-
/// or a pointer which preserves pointer provenance.
315+
/// Data associated with an [`Event`]. This can either be a 64-bit integer
316+
/// value or a pointer which preserves pointer provenance.
317317
#[repr(C)]
318318
#[derive(Copy, Clone)]
319319
pub union EventData {

src/backend/libc/fs/inotify.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bitflags! {
3838
const CLOSE_NOWRITE = c::IN_CLOSE_NOWRITE;
3939
/// `IN_CLOSE_WRITE`
4040
const CLOSE_WRITE = c::IN_CLOSE_WRITE;
41-
/// `IN_CREATE `
41+
/// `IN_CREATE`
4242
const CREATE = c::IN_CREATE;
4343
/// `IN_DELETE`
4444
const DELETE = c::IN_DELETE;
@@ -105,8 +105,8 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
105105
flags: WatchFlags,
106106
) -> io::Result<i32> {
107107
path.into_with_c_str(|path| {
108-
// SAFETY: The fd and path we are passing is guaranteed valid by the type
109-
// system.
108+
// SAFETY: The fd and path we are passing is guaranteed valid by the
109+
// type system.
110110
unsafe {
111111
ret_c_int(c::inotify_add_watch(
112112
borrowed_fd(inot),

src/backend/libc/fs/syscalls.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,8 +839,8 @@ pub(crate) fn utimensat(
839839
));
840840
}
841841

842-
// `setattrlistat` was introduced in 10.13 along with `utimensat`, so if
843-
// we don't have `utimensat`, we don't have `setattrlistat` either.
842+
// `setattrlistat` was introduced in 10.13 along with `utimensat`, so
843+
// if we don't have `utimensat`, we don't have `setattrlistat` either.
844844
// Emulate it using `fork`, and `fchdir` and [`setattrlist`].
845845
//
846846
// [`setattrlist`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setattrlist.2.html
@@ -1565,7 +1565,8 @@ pub(crate) fn fallocate(
15651565
assert!(mode.is_empty());
15661566
let err = unsafe { c::posix_fallocate(borrowed_fd(fd), offset, len) };
15671567

1568-
// `posix_fallocate` returns its error status rather than using `errno`.
1568+
// `posix_fallocate` returns its error status rather than using
1569+
// `errno`.
15691570
if err == 0 {
15701571
Ok(())
15711572
} else {

src/backend/libc/fs/types.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ bitflags! {
213213
/// Similar to `ACCMODE`, but just includes the read/write flags, and
214214
/// no other flags.
215215
///
216-
/// Some implementations include `O_PATH` in `O_ACCMODE`, when
216+
/// On some platforms, `PATH` may be included in `ACCMODE`, when
217217
/// sometimes we really just want the read/write bits. Caution is
218-
/// indicated, as the presence of `O_PATH` may mean that the read/write
218+
/// indicated, as the presence of `PATH` may mean that the read/write
219219
/// bits don't have their usual meaning.
220220
const RWMODE = bitcast!(c::O_RDONLY | c::O_WRONLY | c::O_RDWR);
221221

@@ -638,13 +638,13 @@ bitflags! {
638638
#[repr(transparent)]
639639
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
640640
pub struct SealFlags: u32 {
641-
/// `F_SEAL_SEAL`.
641+
/// `F_SEAL_SEAL`
642642
const SEAL = bitcast!(c::F_SEAL_SEAL);
643-
/// `F_SEAL_SHRINK`.
643+
/// `F_SEAL_SHRINK`
644644
const SHRINK = bitcast!(c::F_SEAL_SHRINK);
645-
/// `F_SEAL_GROW`.
645+
/// `F_SEAL_GROW`
646646
const GROW = bitcast!(c::F_SEAL_GROW);
647-
/// `F_SEAL_WRITE`.
647+
/// `F_SEAL_WRITE`
648648
const WRITE = bitcast!(c::F_SEAL_WRITE);
649649
/// `F_SEAL_FUTURE_WRITE` (since Linux 5.1)
650650
#[cfg(linux_kernel)]

src/backend/libc/net/read_sockaddr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ pub(crate) unsafe fn read_sockaddr(
139139

140140
// Trim off unused bytes from the end of `path_bytes`.
141141
let path_bytes = if cfg!(target_os = "freebsd") {
142-
// FreeBSD sometimes sets the length to longer than the length
143-
// of the NUL-terminated string. Find the NUL and truncate the
144-
// string accordingly.
142+
// FreeBSD sometimes sets the length to longer than the
143+
// length of the NUL-terminated string. Find the NUL and
144+
// truncate the string accordingly.
145145
&decode.sun_path[..decode
146146
.sun_path
147147
.iter()

src/backend/libc/net/sockopt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ use alloc::string::String;
7070
use c::TCP_KEEPALIVE as TCP_KEEPIDLE;
7171
#[cfg(not(any(apple, target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
7272
use c::TCP_KEEPIDLE;
73-
use core::mem::size_of;
74-
use core::mem::MaybeUninit;
73+
use core::mem::{size_of, MaybeUninit};
7574
use core::time::Duration;
7675
#[cfg(windows)]
7776
use windows_sys::Win32::Foundation::BOOL;

src/backend/libc/pty/syscalls.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CSt
6767
if let Some(libc_ptsname_r) = ptsname_r.get() {
6868
libc_ptsname_r(borrowed_fd(fd), buffer.as_mut_ptr().cast(), buffer.len())
6969
} else {
70-
// The size declared in the `TIOCPTYGNAME` macro in sys/ttycom.h is 128.
70+
// The size declared in the `TIOCPTYGNAME` macro in
71+
// sys/ttycom.h is 128.
7172
let mut name: [u8; 128] = [0_u8; 128];
7273
match c::ioctl(borrowed_fd(fd), c::TIOCPTYGNAME as _, &mut name) {
7374
0 => {
@@ -87,7 +88,8 @@ pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CSt
8788
return Err(io::Errno::from_raw_os_error(r));
8889
}
8990

90-
buffer.reserve(1); // use `Vec` reallocation strategy to grow capacity exponentially
91+
// Use `Vec` reallocation strategy to grow capacity exponentially.
92+
buffer.reserve(1);
9193
buffer.resize(buffer.capacity(), 0_u8);
9294
}
9395
}

src/backend/libc/termios/syscalls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ pub(crate) fn tcsetattr(
148148
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
149149
const TCSETS2: u32 = 0x802c540d;
150150

151-
// Translate from `optional_actions` into an ioctl request code. On MIPS,
152-
// `optional_actions` already has `TCGETS` added to it.
151+
// Translate from `optional_actions` into an ioctl request code. On
152+
// MIPS, `optional_actions` already has `TCGETS` added to it.
153153
let request = TCSETS2
154154
+ if cfg!(any(
155155
target_arch = "mips",

src/backend/linux_raw/event/epoll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ pub struct Event {
288288
pub data: EventData,
289289
}
290290

291-
/// Data assocated with an [`Event`]. This can either be a 64-bit integer value
292-
/// or a pointer which preserves pointer provenance.
291+
/// Data associated with an [`Event`]. This can either be a 64-bit integer
292+
/// value or a pointer which preserves pointer provenance.
293293
#[repr(C)]
294294
#[derive(Copy, Clone)]
295295
pub union EventData {

0 commit comments

Comments
 (0)