Skip to content

Commit 862eee3

Browse files
authored
refactor: clippy cleanup doc_overindented_list_items and macro_metavars_in_unsafe (#2592)
1 parent 26bb085 commit 862eee3

File tree

4 files changed

+38
-43
lines changed

4 files changed

+38
-43
lines changed

src/sys/aio.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,9 @@ impl<'a> AioFsync<'a> {
455455
/// * `fd`: File descriptor to sync.
456456
/// * `mode`: Whether to sync file metadata too, or just data.
457457
/// * `prio`: If POSIX Prioritized IO is supported, then the
458-
/// operation will be prioritized at the process's
459-
/// priority level minus `prio`.
460-
/// * `sigev_notify`: Determines how you will be notified of event
461-
/// completion.
458+
/// operation will be prioritized at the process's priority level minus
459+
/// `prio`.
460+
/// * `sigev_notify`: Determines how you will be notified of event completion.
462461
pub fn new(
463462
fd: BorrowedFd<'a>,
464463
mode: AioFsyncMode,
@@ -573,11 +572,9 @@ impl<'a> AioRead<'a> {
573572
/// * `fd`: File descriptor to read from
574573
/// * `offs`: File offset
575574
/// * `buf`: A memory buffer. It must outlive the `AioRead`.
576-
/// * `prio`: If POSIX Prioritized IO is supported, then the
577-
/// operation will be prioritized at the process's
578-
/// priority level minus `prio`
579-
/// * `sigev_notify`: Determines how you will be notified of event
580-
/// completion.
575+
/// * `prio`: If POSIX Prioritized IO is supported, then the operation
576+
/// will be prioritized at the process's priority level minus `prio`
577+
/// * `sigev_notify`: Determines how you will be notified of event completion.
581578
pub fn new(
582579
fd: BorrowedFd<'a>,
583580
offs: off_t,
@@ -805,11 +802,9 @@ impl<'a> AioWrite<'a> {
805802
/// * `fd`: File descriptor to write to
806803
/// * `offs`: File offset
807804
/// * `buf`: A memory buffer. It must outlive the `AioWrite`.
808-
/// * `prio`: If POSIX Prioritized IO is supported, then the
809-
/// operation will be prioritized at the process's
810-
/// priority level minus `prio`
811-
/// * `sigev_notify`: Determines how you will be notified of event
812-
/// completion.
805+
/// * `prio`: If POSIX Prioritized IO is supported, then the operation
806+
/// will be prioritized at the process's priority level minus `prio`
807+
/// * `sigev_notify`: Determines how you will be notified of event completion.
813808
pub fn new(
814809
fd: BorrowedFd<'a>,
815810
offs: off_t,

src/sys/ioctl/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,10 @@ macro_rules! ioctl_readwrite {
655655
pub unsafe fn $name(fd: $crate::libc::c_int,
656656
data: *mut $ty)
657657
-> $crate::Result<$crate::libc::c_int> {
658+
let ioty = $ioty;
659+
let nr = $nr;
658660
unsafe {
659-
convert_ioctl_res!($crate::libc::ioctl(fd, request_code_readwrite!($ioty, $nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data))
661+
convert_ioctl_res!($crate::libc::ioctl(fd, request_code_readwrite!(ioty, nr, ::std::mem::size_of::<$ty>()) as $crate::sys::ioctl::ioctl_num_type, data))
660662
}
661663
}
662664
)

src/sys/socket/addr.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -655,15 +655,13 @@ pub trait SockaddrLike: private::SockaddrLikePriv {
655655
///
656656
/// # Arguments
657657
///
658-
/// - `addr`: raw pointer to something that can be cast to a
659-
/// `libc::sockaddr`. For example, `libc::sockaddr_in`,
660-
/// `libc::sockaddr_in6`, etc.
661-
/// - `len`: For fixed-width types like `sockaddr_in`, it will be
662-
/// validated if present and ignored if not. For variable-width
663-
/// types it is required and must be the total length of valid
664-
/// data. For example, if `addr` points to a
665-
/// named `sockaddr_un`, then `len` must be the length of the
666-
/// structure up to but not including the trailing NUL.
658+
/// - `addr`: raw pointer to something that can be cast to a `libc::sockaddr`.
659+
/// For example, `libc::sockaddr_in`, `libc::sockaddr_in6`, etc.
660+
/// - `len`: For fixed-width types like `sockaddr_in`, it will be validated
661+
/// if present and ignored if not. For variable-width types it is required
662+
/// and must be the total length of valid data. For example, if `addr`
663+
/// points to a named `sockaddr_un`, then `len` must be the length of the
664+
/// structure up to but not including the trailing NUL.
667665
///
668666
/// # Safety
669667
///

src/sys/socket/sockopt.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ const TCP_CA_NAME_MAX: usize = 16;
3333
///
3434
/// * `$name:ident`: name of the type you want to implement `SetSockOpt` for.
3535
/// * `$level:expr` : socket layer, or a `protocol level`: could be *raw sockets*
36-
/// (`libc::SOL_SOCKET`), *ip protocol* (libc::IPPROTO_IP), *tcp protocol* (`libc::IPPROTO_TCP`),
37-
/// and more. Please refer to your system manual for more options. Will be passed as the second
38-
/// argument (`level`) to the `setsockopt` call.
36+
/// (`libc::SOL_SOCKET`), *ip protocol* (libc::IPPROTO_IP), *tcp protocol* (`libc::IPPROTO_TCP`),
37+
/// and more. Please refer to your system manual for more options. Will be passed as the second
38+
/// argument (`level`) to the `setsockopt` call.
3939
/// * `$flag:path`: a flag name to set. Some examples: `libc::SO_REUSEADDR`, `libc::TCP_NODELAY`,
40-
/// `libc::IP_ADD_MEMBERSHIP` and others. Will be passed as the third argument (`option_name`)
41-
/// to the `setsockopt` call.
40+
/// `libc::IP_ADD_MEMBERSHIP` and others. Will be passed as the third argument (`option_name`)
41+
/// to the `setsockopt` call.
4242
/// * Type of the value that you are going to set.
43-
/// * Type that implements the `Set` trait for the type from the previous item (like `SetBool` for
44-
/// `bool`, `SetUsize` for `usize`, etc.).
43+
/// * Type that implements the `Set` trait for the type from the previous item
44+
/// (like `SetBool` for `bool`, `SetUsize` for `usize`, etc.).
4545
#[macro_export]
4646
macro_rules! setsockopt_impl {
4747
($name:ident, $level:expr, $flag:path, $ty:ty, $setter:ty) => {
@@ -87,15 +87,15 @@ macro_rules! setsockopt_impl {
8787
///
8888
/// * Name of the type you want to implement `GetSockOpt` for.
8989
/// * Socket layer, or a `protocol level`: could be *raw sockets* (`lic::SOL_SOCKET`), *ip
90-
/// protocol* (libc::IPPROTO_IP), *tcp protocol* (`libc::IPPROTO_TCP`), and more. Please refer
91-
/// to your system manual for more options. Will be passed as the second argument (`level`) to
92-
/// the `getsockopt` call.
90+
/// protocol* (libc::IPPROTO_IP), *tcp protocol* (`libc::IPPROTO_TCP`), and more. Please refer
91+
/// to your system manual for more options. Will be passed as the second argument (`level`) to
92+
/// the `getsockopt` call.
9393
/// * A flag to set. Some examples: `libc::SO_REUSEADDR`, `libc::TCP_NODELAY`,
94-
/// `libc::SO_ORIGINAL_DST` and others. Will be passed as the third argument (`option_name`) to
95-
/// the `getsockopt` call.
94+
/// `libc::SO_ORIGINAL_DST` and others. Will be passed as the third argument (`option_name`) to
95+
/// the `getsockopt` call.
9696
/// * Type of the value that you are going to get.
9797
/// * Type that implements the `Get` trait for the type from the previous item (`GetBool` for
98-
/// `bool`, `GetUsize` for `usize`, etc.).
98+
/// `bool`, `GetUsize` for `usize`, etc.).
9999
#[macro_export]
100100
macro_rules! getsockopt_impl {
101101
($name:ident, $level:expr, $flag:path, $ty:ty, $getter:ty) => {
@@ -161,15 +161,15 @@ macro_rules! getsockopt_impl {
161161
/// # Arguments
162162
///
163163
/// * `GetOnly`, `SetOnly` or `Both`: whether you want to implement only getter, only setter or
164-
/// both of them.
164+
/// both of them.
165165
/// * `$name:ident`: name of type `GetSockOpt`/`SetSockOpt` will be implemented for.
166166
/// * `$level:expr` : socket layer, or a `protocol level`: could be *raw sockets*
167-
/// (`libc::SOL_SOCKET`), *ip protocol* (libc::IPPROTO_IP), *tcp protocol* (`libc::IPPROTO_TCP`),
168-
/// and more. Please refer to your system manual for more options. Will be passed as the second
169-
/// argument (`level`) to the `getsockopt`/`setsockopt` call.
167+
/// (`libc::SOL_SOCKET`), *ip protocol* (libc::IPPROTO_IP), *tcp protocol* (`libc::IPPROTO_TCP`),
168+
/// and more. Please refer to your system manual for more options. Will be passed as the second
169+
/// argument (`level`) to the `getsockopt`/`setsockopt` call.
170170
/// * `$flag:path`: a flag name to set. Some examples: `libc::SO_REUSEADDR`, `libc::TCP_NODELAY`,
171-
/// `libc::IP_ADD_MEMBERSHIP` and others. Will be passed as the third argument (`option_name`)
172-
/// to the `setsockopt`/`getsockopt` call.
171+
/// `libc::IP_ADD_MEMBERSHIP` and others. Will be passed as the third argument (`option_name`)
172+
/// to the `setsockopt`/`getsockopt` call.
173173
/// * `$ty:ty`: type of the value that will be get/set.
174174
/// * `$getter:ty`: `Get` implementation; optional; only for `GetOnly` and `Both`.
175175
/// * `$setter:ty`: `Set` implementation; optional; only for `SetOnly` and `Both`.

0 commit comments

Comments
 (0)