Skip to content

Commit dd3de92

Browse files
authored
Minor comment formatting cleanups. (#561)
Use shorter docs.rs URLs in comments, update to upstream Rust files that include more comments, and other miscellaenous comment formatting fixes.
1 parent bc63c50 commit dd3de92

File tree

21 files changed

+73
-56
lines changed

21 files changed

+73
-56
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ by default. The rest of the API is conditional with cargo feature flags:
7070
| |
7171
| `use-libc` | Enable the libc backend.
7272

73-
[`rustix::fs`]: https://docs.rs/rustix/latest/rustix/fs/index.html
74-
[`rustix::io_uring`]: https://docs.rs/rustix/latest/rustix/io_uring/index.html
75-
[`rustix::mm`]: https://docs.rs/rustix/latest/rustix/mm/index.html
76-
[`rustix::net`]: https://docs.rs/rustix/latest/rustix/net/index.html
77-
[`rustix::param`]: https://docs.rs/rustix/latest/rustix/param/index.html
78-
[`rustix::process`]: https://docs.rs/rustix/latest/rustix/process/index.html
79-
[`rustix::rand`]: https://docs.rs/rustix/latest/rustix/rand/index.html
80-
[`rustix::termios`]: https://docs.rs/rustix/latest/rustix/termios/index.html
81-
[`rustix::thread`]: https://docs.rs/rustix/latest/rustix/thread/index.html
82-
[`rustix::time`]: https://docs.rs/rustix/latest/rustix/time/index.html
83-
[`rustix::io`]: https://docs.rs/rustix/latest/rustix/io/index.html
84-
[`rustix::fd`]: https://docs.rs/rustix/latest/rustix/fd/index.html
85-
[`rustix::ffi`]: https://docs.rs/rustix/latest/rustix/ffi/index.html
86-
[`rustix::path`]: https://docs.rs/rustix/latest/rustix/path/index.html
73+
[`rustix::fs`]: https://docs.rs/rustix/*/rustix/fs/index.html
74+
[`rustix::io_uring`]: https://docs.rs/rustix/*/rustix/io_uring/index.html
75+
[`rustix::mm`]: https://docs.rs/rustix/*/rustix/mm/index.html
76+
[`rustix::net`]: https://docs.rs/rustix/*/rustix/net/index.html
77+
[`rustix::param`]: https://docs.rs/rustix/*/rustix/param/index.html
78+
[`rustix::process`]: https://docs.rs/rustix/*/rustix/process/index.html
79+
[`rustix::rand`]: https://docs.rs/rustix/*/rustix/rand/index.html
80+
[`rustix::termios`]: https://docs.rs/rustix/*/rustix/termios/index.html
81+
[`rustix::thread`]: https://docs.rs/rustix/*/rustix/thread/index.html
82+
[`rustix::time`]: https://docs.rs/rustix/*/rustix/time/index.html
83+
[`rustix::io`]: https://docs.rs/rustix/*/rustix/io/index.html
84+
[`rustix::fd`]: https://docs.rs/rustix/*/rustix/fd/index.html
85+
[`rustix::ffi`]: https://docs.rs/rustix/*/rustix/ffi/index.html
86+
[`rustix::path`]: https://docs.rs/rustix/*/rustix/path/index.html
8787

8888
## Similar crates
8989

@@ -152,10 +152,10 @@ version of this crate.
152152
[`timerfd`]: https://crates.io/crates/timerfd
153153
[`io-streams`]: https://crates.io/crates/io-streams
154154
[`bitflags`]: https://crates.io/crates/bitflags
155-
[`Arg`]: https://docs.rs/rustix/latest/rustix/path/trait.Arg.html
155+
[`Arg`]: https://docs.rs/rustix/*/rustix/path/trait.Arg.html
156156
[I/O-safe]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
157157
[I/O safety]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
158158
[provenance]: https://github.com/rust-lang/rust/issues/95228
159-
[`OwnedFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/struct.OwnedFd.html
160-
[`AsFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.AsFd.html
161-
[`NOSYS`]: https://docs.rs/rustix/latest/rustix/io/struct.Errno.html#associatedconstant.NOSYS
159+
[`OwnedFd`]: https://docs.rs/io-lifetimes/*/io_lifetimes/struct.OwnedFd.html
160+
[`AsFd`]: https://docs.rs/io-lifetimes/*/io_lifetimes/trait.AsFd.html
161+
[`NOSYS`]: https://docs.rs/rustix/*/rustix/io/struct.Errno.html#associatedconstant.NOSYS

examples/dup2_to_replace_stdio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main() {
3838
drop(reader);
3939
drop(writer);
4040

41-
// Now we can print to "stdout" in the usual way, and it'll go to our pipe.
41+
// Now we can print to stdout in the usual way, and it'll go to our pipe.
4242
println!("hello, world!");
4343

4444
// And we can read from stdin, and it'll read from our pipe. It's a little

src/backend/libc/fs/dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
237237
pub d_pino: i64,
238238
pub d_reclen: ::c_ushort,
239239
pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
240-
// */
240+
*/
241241

242242
// On dragonfly and FreeBSD 12, `dirent` has some non-public padding fields
243243
// so we can't directly initialize it.

src/backend/libc/fs/inotify.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
8181
unsafe { ret_owned_fd(c::inotify_init1(flags.bits())) }
8282
}
8383

84-
/// `inotify_add_watch(self, path, flags)`-Adds a watch to inotify
84+
/// `inotify_add_watch(self, path, flags)`Adds a watch to inotify
8585
///
8686
/// This registers or updates a watch for the filesystem path `path`
8787
/// and returns a watch descriptor corresponding to this watch.
@@ -96,7 +96,7 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
9696
flags: WatchFlags,
9797
) -> io::Result<i32> {
9898
let path = path.as_cow_c_str().unwrap();
99-
// SAFETY: The fd and path we are passing is guranteed valid by the type
99+
// SAFETY: The fd and path we are passing is guaranteed valid by the type
100100
// system.
101101
unsafe {
102102
ret_c_int(c::inotify_add_watch(
@@ -107,7 +107,7 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
107107
}
108108
}
109109

110-
/// `inotify_rm_watch(self, wd)`-Removes a watch from this inotify
110+
/// `inotify_rm_watch(self, wd)`Removes a watch from this inotify
111111
///
112112
/// The watch descriptor provided should have previously been returned
113113
/// by [`inotify_add_watch`] and not previously have been removed.

src/backend/libc/fs/syscalls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub(crate) fn openat(
162162
mode: Mode,
163163
) -> io::Result<OwnedFd> {
164164
// Work around <https://sourceware.org/bugzilla/show_bug.cgi?id=17523>.
165-
// Basically old glibc versions don't handle O_TMPFILE correctly.
165+
// GLIBC versions before 2.25 don't handle `O_TMPFILE` correctly.
166166
#[cfg(all(unix, target_env = "gnu"))]
167167
if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() {
168168
return openat_via_syscall(dirfd, path, oflags, mode);
@@ -1593,7 +1593,7 @@ pub(crate) unsafe fn copyfile_state_get(
15931593

15941594
#[cfg(apple)]
15951595
pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> {
1596-
// The use of PATH_MAX is generally not encouraged, but it
1596+
// The use of `PATH_MAX` is generally not encouraged, but it
15971597
// is inevitable in this case because macOS defines `fcntl` with
15981598
// `F_GETPATH` in terms of `MAXPATHLEN`, and there are no
15991599
// alternatives. If a better method is invented, it should be used

src/backend/libc/io/syscalls.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub(crate) fn pwritev2(
242242
}
243243

244244
// These functions are derived from Rust's library/std/src/sys/unix/fd.rs at
245-
// revision a77da2d454e6caa227a85b16410b95f93495e7e0.
245+
// revision 326ef470a8b379a180d6dc4bbef08990698a737a.
246246

247247
// The maximum read limit on most POSIX-like systems is `SSIZE_MAX`, with the
248248
// man page quoting that if the count of bytes to read is greater than
@@ -262,7 +262,12 @@ const fn max_iov() -> usize {
262262
c::IOV_MAX as usize
263263
}
264264

265-
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))]
265+
#[cfg(any(
266+
target_os = "android",
267+
target_os = "emscripten",
268+
target_os = "linux",
269+
target_os = "nto"
270+
))]
266271
const fn max_iov() -> usize {
267272
c::UIO_MAXIOV as usize
268273
}
@@ -272,6 +277,8 @@ const fn max_iov() -> usize {
272277
target_os = "android",
273278
target_os = "emscripten",
274279
target_os = "linux",
280+
target_os = "nto",
281+
target_os = "horizon",
275282
)))]
276283
const fn max_iov() -> usize {
277284
16 // The minimum value required by POSIX.

src/backend/linux_raw/fs/inotify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
8080
syscalls::inotify_init1(flags)
8181
}
8282

83-
/// `inotify_add_watch(self, path, flags)`-Adds a watch to inotify
83+
/// `inotify_add_watch(self, path, flags)`Adds a watch to inotify
8484
///
8585
/// This registers or updates a watch for the filesystem path `path`
8686
/// and returns a watch descriptor corresponding to this watch.
@@ -98,7 +98,7 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
9898
syscalls::inotify_add_watch(inot, &path, flags)
9999
}
100100

101-
/// `inotify_rm_watch(self, wd)`-Removes a watch from this inotify
101+
/// `inotify_rm_watch(self, wd)`Removes a watch from this inotify
102102
///
103103
/// The watch descriptor provided should have previously been returned
104104
/// by [`inotify_add_watch`] and not previously have been removed.

src/io/kqueue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl UserDefinedFlags {
310310
}
311311
}
312312

313-
/// `kqueue()`- Create a new `kqueue` file descriptor.
313+
/// `kqueue()`Create a new `kqueue` file descriptor.
314314
///
315315
/// # References
316316
///
@@ -329,7 +329,8 @@ pub fn kqueue() -> io::Result<OwnedFd> {
329329
syscalls::kqueue()
330330
}
331331

332-
/// `kevent()`- Wait for events on a `kqueue`.
332+
/// `kevent(kqueue, changelist, eventlist, timeout)`—Wait for events on a
333+
/// `kqueue`.
333334
///
334335
/// # Safety
335336
///

src/io/port.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Solaris/Illumos event ports.
1+
//! Solaris/illumos event ports.
22
33
use crate::backend::c;
44
use crate::backend::io::syscalls;
@@ -31,7 +31,7 @@ impl Event {
3131
}
3232
}
3333

34-
/// `port_create()`- Creates a new port.
34+
/// `port_create()`Creates a new port.
3535
///
3636
/// # References
3737
///
@@ -44,7 +44,7 @@ pub fn port_create() -> io::Result<OwnedFd> {
4444
syscalls::port_create()
4545
}
4646

47-
/// `port_associate(_, PORT_SOURCE_FD, _, _, _)`- Associates a file descriptor
47+
/// `port_associate(_, PORT_SOURCE_FD, _, _, _)`Associates a file descriptor
4848
/// with a port.
4949
///
5050
/// # Safety
@@ -75,7 +75,7 @@ pub unsafe fn port_associate_fd(
7575
)
7676
}
7777

78-
/// `port_dissociate(_, PORT_SOURCE_FD, _)`- Dissociates a file descriptor from
78+
/// `port_dissociate(_, PORT_SOURCE_FD, _)`Dissociates a file descriptor from
7979
/// a port.
8080
///
8181
/// # Safety
@@ -94,7 +94,7 @@ pub unsafe fn port_dissociate_fd(port: impl AsFd, object: impl AsRawFd) -> io::R
9494
syscalls::port_dissociate(port.as_fd(), c::PORT_SOURCE_FD, object.as_raw_fd() as _)
9595
}
9696

97-
/// `port_get(port, timeout)`- Gets an event from a port.
97+
/// `port_get(port, timeout)`Gets an event from a port.
9898
///
9999
/// # References
100100
///
@@ -112,7 +112,7 @@ pub fn port_get(port: impl AsFd, timeout: Option<Duration>) -> io::Result<Event>
112112
syscalls::port_get(port.as_fd(), timeout.as_mut())
113113
}
114114

115-
/// `port_getn(port, events, min_events, timeout)`- Gets multiple events from a
115+
/// `port_getn(port, events, min_events, timeout)`Gets multiple events from a
116116
/// port.
117117
///
118118
/// # References
@@ -143,7 +143,7 @@ pub fn port_getn(
143143
)
144144
}
145145

146-
/// `port_send(port, events, userdata)`- Sends an event to a port.
146+
/// `port_send(port, events, userdata)`Sends an event to a port.
147147
///
148148
/// # References
149149
///

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
//! [`OwnedFd`]: https://doc.rust-lang.org/stable/std/os/fd/struct.OwnedFd.html
9191
//! [I/O-safe]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
9292
//! [`Result`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html
93-
//! [`Arg`]: https://docs.rs/rustix/latest/rustix/path/trait.Arg.html
93+
//! [`Arg`]: https://docs.rs/rustix/*/rustix/path/trait.Arg.html
9494
9595
#![deny(missing_docs)]
9696
#![allow(stable_features)]

0 commit comments

Comments
 (0)