Skip to content

Commit 8708d5b

Browse files
authored
refactor: some clippy warnings (#2250)
1 parent a90b4b2 commit 8708d5b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/poll_timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl PollTimeout {
1414
/// > Specifying a timeout of zero causes poll() to return immediately, even if no file
1515
/// > descriptors are ready.
1616
pub const ZERO: Self = Self(0);
17-
/// Blocks for at most [`std::i32::MAX`] milliseconds.
17+
/// Blocks for at most [`i32::MAX`] milliseconds.
1818
pub const MAX: Self = Self(i32::MAX);
1919
/// Returns if `self` equals [`PollTimeout::NONE`].
2020
pub fn is_none(&self) -> bool {

src/sys/socket/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ impl<S> MultiHeaders<S> {
15991599
.enumerate()
16001600
.map(|(ix, address)| {
16011601
let (ptr, cap) = match &mut cmsg_buffers {
1602-
Some(v) => ((&mut v[ix * msg_controllen] as *mut u8), msg_controllen),
1602+
Some(v) => (&mut v[ix * msg_controllen] as *mut u8, msg_controllen),
16031603
None => (std::ptr::null_mut(), 0),
16041604
};
16051605
let msg_hdr = unsafe { pack_mhdr_to_receive(std::ptr::null_mut(), 0, ptr, cap, address.as_mut_ptr()) };

src/unistd.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ pub fn getgroups() -> Result<Vec<Gid>> {
15261526
// equal to the value of {NGROUPS_MAX} + 1.
15271527
let ngroups_max = match sysconf(SysconfVar::NGROUPS_MAX) {
15281528
Ok(Some(n)) => (n + 1) as usize,
1529-
Ok(None) | Err(_) => <usize>::max_value(),
1529+
Ok(None) | Err(_) => usize::MAX,
15301530
};
15311531

15321532
// Next, get the number of groups so we can size our Vec
@@ -1660,7 +1660,7 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> {
16601660
pub fn getgrouplist(user: &CStr, group: Gid) -> Result<Vec<Gid>> {
16611661
let ngroups_max = match sysconf(SysconfVar::NGROUPS_MAX) {
16621662
Ok(Some(n)) => n as c_int,
1663-
Ok(None) | Err(_) => <c_int>::max_value(),
1663+
Ok(None) | Err(_) => c_int::MAX,
16641664
};
16651665
use std::cmp::min;
16661666
let mut groups = Vec::<Gid>::with_capacity(min(ngroups_max, 8) as usize);
@@ -2867,9 +2867,9 @@ mod getres {
28672867
///
28682868
#[inline]
28692869
pub fn getresuid() -> Result<ResUid> {
2870-
let mut ruid = libc::uid_t::max_value();
2871-
let mut euid = libc::uid_t::max_value();
2872-
let mut suid = libc::uid_t::max_value();
2870+
let mut ruid = libc::uid_t::MAX;
2871+
let mut euid = libc::uid_t::MAX;
2872+
let mut suid = libc::uid_t::MAX;
28732873
let res = unsafe { libc::getresuid(&mut ruid, &mut euid, &mut suid) };
28742874

28752875
Errno::result(res).map(|_| ResUid {
@@ -2890,9 +2890,9 @@ mod getres {
28902890
///
28912891
#[inline]
28922892
pub fn getresgid() -> Result<ResGid> {
2893-
let mut rgid = libc::gid_t::max_value();
2894-
let mut egid = libc::gid_t::max_value();
2895-
let mut sgid = libc::gid_t::max_value();
2893+
let mut rgid = libc::gid_t::MAX;
2894+
let mut egid = libc::gid_t::MAX;
2895+
let mut sgid = libc::gid_t::MAX;
28962896
let res = unsafe { libc::getresgid(&mut rgid, &mut egid, &mut sgid) };
28972897

28982898
Errno::result(res).map(|_| ResGid {

test/test_unistd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,8 @@ fn test_linkat_follow_symlink() {
11031103

11041104
// Check the file type of the new link
11051105
assert_eq!(
1106-
(stat::SFlag::from_bits_truncate(newfilestat.st_mode as mode_t)
1107-
& SFlag::S_IFMT),
1106+
stat::SFlag::from_bits_truncate(newfilestat.st_mode as mode_t)
1107+
& SFlag::S_IFMT,
11081108
SFlag::S_IFREG
11091109
);
11101110

0 commit comments

Comments
 (0)