Skip to content

Commit f3205dd

Browse files
authored
Miscellaneous documentation and clippy fixes. (#1354)
1 parent c407d8b commit f3205dd

20 files changed

Lines changed: 67 additions & 45 deletions

File tree

benches/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
))]
2121
fn main() {
2222
unimplemented!(
23-
"Add --cfg=criterion to RUSTFLAGS and enable the \"fs\", \"time\", \"process\", and \"stdio\" cargo \
24-
features."
23+
"Add --cfg=criterion to RUSTFLAGS and enable the \"fs\", \"time\", \"process\", and \
24+
\"stdio\" cargo features."
2525
)
2626
}
2727

src/backend/libc/c.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ mod readwrite_pv64 {
258258
fun(fd, iov, iovcnt, offset)
259259
} else {
260260
// Unlike the plain "p" functions, the "pv" functions pass their
261-
// offset in an endian-independent way, and always in two registers.
261+
// offset in an endian-independent way, and always in two
262+
// registers.
262263
syscall! {
263264
fn preadv(
264265
fd: c_int,
@@ -285,7 +286,8 @@ mod readwrite_pv64 {
285286
fun(fd, iov, iovcnt, offset)
286287
} else {
287288
// Unlike the plain "p" functions, the "pv" functions pass their
288-
// offset in an endian-independent way, and always in two registers.
289+
// offset in an endian-independent way, and always in two
290+
// registers.
289291
syscall! {
290292
fn pwritev(
291293
fd: c_int,
@@ -348,7 +350,8 @@ mod readwrite_pv64v2 {
348350
fun(fd, iov, iovcnt, offset, flags)
349351
} else {
350352
// Unlike the plain "p" functions, the "pv" functions pass their
351-
// offset in an endian-independent way, and always in two registers.
353+
// offset in an endian-independent way, and always in two
354+
// registers.
352355
syscall! {
353356
fn preadv2(
354357
fd: c_int,
@@ -384,7 +387,8 @@ mod readwrite_pv64v2 {
384387
fun(fd, iov, iovcnt, offset, flags)
385388
} else {
386389
// Unlike the plain "p" functions, the "pv" functions pass their
387-
// offset in an endian-independent way, and always in two registers.
390+
// offset in an endian-independent way, and always in two
391+
// registers.
388392
syscall! {
389393
fn pwritev2(
390394
fd: c_int,

src/backend/libc/fs/dir.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ impl Dir {
154154

155155
/// `readdir(self)`, where `None` means the end of the directory.
156156
pub fn read(&mut self) -> Option<io::Result<DirEntry>> {
157-
// If we've seen errors, don't continue to try to read anything further.
157+
// If we've seen errors, don't continue to try to read anything
158+
// further.
158159
if self.any_errors {
159160
return None;
160161
}

src/backend/libc/net/addr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ impl SocketAddrUnix {
125125
pub fn path(&self) -> Option<&CStr> {
126126
let bytes = self.bytes()?;
127127
if !bytes.is_empty() && bytes[0] != 0 {
128-
// SAFETY: `from_bytes_with_nul_unchecked` since the string is NUL-terminated.
128+
// SAFETY: `from_bytes_with_nul_unchecked` since the string is
129+
// NUL-terminated.
129130
Some(unsafe { CStr::from_bytes_with_nul_unchecked(bytes) })
130131
} else {
131132
None

src/backend/libc/process/syscalls.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ pub(crate) fn fcntl_getlk(fd: BorrowedFd<'_>, lock: &Flock) -> io::Result<Option
669669
let mut curr_lock: c::flock = lock.as_raw();
670670
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_GETLK, &mut curr_lock))? };
671671

672-
// If no blocking lock is found, `fcntl(GETLK, ..)` sets `l_type` to `F_UNLCK`
672+
// If no blocking lock is found, `fcntl(GETLK, ..)` sets `l_type` to
673+
// `F_UNLCK`.
673674
if curr_lock.l_type == c::F_UNLCK as _ {
674675
Ok(None)
675676
} else {

src/backend/linux_raw/fs/dir.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ impl Dir {
110110

111111
/// `readdir(self)`, where `None` means the end of the directory.
112112
pub fn read(&mut self) -> Option<io::Result<DirEntry>> {
113-
// If we've seen errors, don't continue to try to read anything further.
113+
// If we've seen errors, don't continue to try to read anything
114+
// further.
114115
if self.any_errors {
115116
return None;
116117
}

src/backend/linux_raw/net/addr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ impl SocketAddrUnix {
9494
pub fn path(&self) -> Option<&CStr> {
9595
let bytes = self.bytes()?;
9696
if !bytes.is_empty() && bytes[0] != 0 {
97-
// SAFETY: `from_bytes_with_nul_unchecked` since the string is NUL-terminated.
97+
// SAFETY: `from_bytes_with_nul_unchecked` since the string is
98+
// NUL-terminated.
9899
Some(unsafe { CStr::from_bytes_with_nul_unchecked(bytes) })
99100
} else {
100101
None

src/backend/linux_raw/process/syscalls.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ pub(crate) fn fcntl_getlk(fd: BorrowedFd<'_>, lock: &Flock) -> io::Result<Option
548548
))?
549549
}
550550

551-
// If no blocking lock is found, `fcntl(GETLK, ..)` sets `l_type` to `F_UNLCK`
551+
// If no blocking lock is found, `fcntl(GETLK, ..)` sets `l_type` to
552+
// `F_UNLCK`.
552553
if curr_lock.l_type == c::F_UNLCK as _ {
553554
Ok(None)
554555
} else {

src/backend/linux_raw/vdso.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ fn init_from_sysinfo_ehdr() -> Option<Vdso> {
218218
// Parse the hash table header.
219219
if !vdso.gnu_hash.is_null() {
220220
vdso.nbucket = ElfHashEntry::from(*vdso.gnu_hash);
221-
// The bucket array is located after the header (4 uint32) and the bloom
222-
// filter (size_t array of gnu_hash[2] elements).
221+
// The bucket array is located after the header (4 uint32) and the
222+
// bloom filter (size_t array of gnu_hash[2] elements).
223223
vdso.bucket = vdso
224224
.gnu_hash
225225
.add(4)
@@ -497,6 +497,8 @@ fn test_vdso() {
497497
#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
498498
let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_gettimeofday"));
499499

500+
// On PowerPC, "__kernel_clock_gettime64" isn't available in
501+
// Linux < 5.11.
500502
#[cfg(not(target_arch = "powerpc"))]
501503
assert!(!ptr.is_null());
502504
}

src/fs/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ mod tests {
2020
#[cfg(linux_kernel)]
2121
assert_eq_size!(FsWord, linux_raw_sys::general::__fsword_t);
2222

23-
// Don't test against `__kernel_mode_t` on platforms where it's a `u16`.
23+
// Don't test against `__kernel_mode_t` on platforms where it's a
24+
// `u16`.
2425
#[cfg(linux_kernel)]
2526
#[cfg(not(any(
2627
target_arch = "x86",

0 commit comments

Comments
 (0)