Skip to content

Commit b8ac8c8

Browse files
eduardosmtgross35
authored andcommitted
Fix unused_qualifications
(backport <rust-lang#4132>) (cherry picked from commit 65e7837)
1 parent 8cb131f commit b8ac8c8

File tree

3 files changed

+31
-34
lines changed

3 files changed

+31
-34
lines changed

build.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,7 @@ fn rustc_minor_nightly() -> (u32, bool) {
185185
}
186186

187187
fn which_freebsd() -> Option<i32> {
188-
let output = std::process::Command::new("freebsd-version")
189-
.output()
190-
.ok()?;
188+
let output = Command::new("freebsd-version").output().ok()?;
191189
if !output.status.success() {
192190
return None;
193191
}
@@ -206,10 +204,7 @@ fn which_freebsd() -> Option<i32> {
206204
}
207205

208206
fn emcc_version_code() -> Option<u64> {
209-
let output = std::process::Command::new("emcc")
210-
.arg("-dumpversion")
211-
.output()
212-
.ok()?;
207+
let output = Command::new("emcc").arg("-dumpversion").output().ok()?;
213208
if !output.status.success() {
214209
return None;
215210
}

src/unix/linux_like/linux/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Linux-specific definitions for linux-like values
22
3-
use core::mem;
3+
use core::mem::size_of;
44

55
pub type useconds_t = u32;
66
pub type dev_t = u64;
@@ -3766,15 +3766,15 @@ pub const TP_FT_REQ_FILL_RXHASH: ::__u32 = 1;
37663766

37673767
pub const TPACKET_ALIGNMENT: usize = 16;
37683768

3769-
pub const TPACKET_HDRLEN: usize = ((mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
3769+
pub const TPACKET_HDRLEN: usize = ((size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1)
37703770
& !(TPACKET_ALIGNMENT - 1))
3771-
+ mem::size_of::<::sockaddr_ll>();
3772-
pub const TPACKET2_HDRLEN: usize = ((mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
3771+
+ size_of::<::sockaddr_ll>();
3772+
pub const TPACKET2_HDRLEN: usize = ((size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1)
37733773
& !(TPACKET_ALIGNMENT - 1))
3774-
+ mem::size_of::<::sockaddr_ll>();
3775-
pub const TPACKET3_HDRLEN: usize = ((mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
3774+
+ size_of::<::sockaddr_ll>();
3775+
pub const TPACKET3_HDRLEN: usize = ((size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1)
37763776
& !(TPACKET_ALIGNMENT - 1))
3777-
+ mem::size_of::<::sockaddr_ll>();
3777+
+ size_of::<::sockaddr_ll>();
37783778

37793779
// linux/netfilter.h
37803780
pub const NF_DROP: ::c_int = 0;
@@ -4238,11 +4238,11 @@ pub const IW_PMKID_CAND_PREAUTH: ::c_ulong = 0x00000001;
42384238
pub const IW_EV_LCP_PK_LEN: usize = 4;
42394239

42404240
pub const IW_EV_CHAR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + ::IFNAMSIZ;
4241-
pub const IW_EV_UINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + ::mem::size_of::<u32>();
4242-
pub const IW_EV_FREQ_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + ::mem::size_of::<iw_freq>();
4243-
pub const IW_EV_PARAM_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + ::mem::size_of::<iw_param>();
4244-
pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + ::mem::size_of::<::sockaddr>();
4245-
pub const IW_EV_QUAL_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + ::mem::size_of::<iw_quality>();
4241+
pub const IW_EV_UINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::<u32>();
4242+
pub const IW_EV_FREQ_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::<iw_freq>();
4243+
pub const IW_EV_PARAM_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + size_of::<iw_param>();
4244+
pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + size_of::<::sockaddr>();
4245+
pub const IW_EV_QUAL_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + size_of::<iw_quality>();
42464246
pub const IW_EV_POINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + 4;
42474247

42484248
pub const IPTOS_TOS_MASK: u8 = 0x1E;
@@ -5322,9 +5322,9 @@ pub const CANXL_MAX_DLEN: usize = 2048;
53225322
pub const CANXL_XLF: ::c_int = 0x80;
53235323
pub const CANXL_SEC: ::c_int = 0x01;
53245324

5325-
pub const CAN_MTU: usize = ::mem::size_of::<can_frame>();
5326-
pub const CANFD_MTU: usize = ::mem::size_of::<canfd_frame>();
5327-
pub const CANXL_MTU: usize = ::mem::size_of::<canxl_frame>();
5325+
pub const CAN_MTU: usize = size_of::<can_frame>();
5326+
pub const CANFD_MTU: usize = size_of::<canfd_frame>();
5327+
pub const CANXL_MTU: usize = size_of::<canxl_frame>();
53285328
// FIXME(offset_of): use `core::mem::offset_of!` once that is available
53295329
// https://github.com/rust-lang/rfcs/pull/3308
53305330
// pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data);
@@ -5800,17 +5800,17 @@ pub(crate) const fn _IO(ty: u32, nr: u32) -> u32 {
58005800

58015801
/// Build an ioctl number for an read-only ioctl.
58025802
pub(crate) const fn _IOR<T>(ty: u32, nr: u32) -> u32 {
5803-
_IOC(_IOC_READ, ty, nr, core::mem::size_of::<T>())
5803+
_IOC(_IOC_READ, ty, nr, size_of::<T>())
58045804
}
58055805

58065806
/// Build an ioctl number for an write-only ioctl.
58075807
pub(crate) const fn _IOW<T>(ty: u32, nr: u32) -> u32 {
5808-
_IOC(_IOC_WRITE, ty, nr, core::mem::size_of::<T>())
5808+
_IOC(_IOC_WRITE, ty, nr, size_of::<T>())
58095809
}
58105810

58115811
/// Build an ioctl number for a read-write ioctl.
58125812
pub(crate) const fn _IOWR<T>(ty: u32, nr: u32) -> u32 {
5813-
_IOC(_IOC_READ | _IOC_WRITE, ty, nr, core::mem::size_of::<T>())
5813+
_IOC(_IOC_READ | _IOC_WRITE, ty, nr, size_of::<T>())
58145814
}
58155815

58165816
f! {
@@ -5819,7 +5819,7 @@ f! {
58195819
}
58205820

58215821
pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr {
5822-
if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
5822+
if ((*cmsg).cmsg_len as usize) < size_of::<cmsghdr>() {
58235823
return 0 as *mut cmsghdr;
58245824
};
58255825
let next = (cmsg as usize + super::CMSG_ALIGN((*cmsg).cmsg_len as usize)) as *mut cmsghdr;
@@ -5875,7 +5875,7 @@ f! {
58755875
}
58765876

58775877
pub fn CPU_COUNT(cpuset: &cpu_set_t) -> ::c_int {
5878-
CPU_COUNT_S(::mem::size_of::<cpu_set_t>(), cpuset)
5878+
CPU_COUNT_S(size_of::<cpu_set_t>(), cpuset)
58795879
}
58805880

58815881
pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {

src/unix/solarish/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::mem::size_of;
2+
13
pub type c_char = i8;
24
pub type c_long = i64;
35
pub type c_ulong = u64;
@@ -710,9 +712,9 @@ cfg_if! {
710712
fn data_field_count(&self) -> usize {
711713
match self.si_signo {
712714
::SIGSEGV | ::SIGBUS | ::SIGILL | ::SIGTRAP | ::SIGFPE => {
713-
::mem::size_of::<siginfo_fault>() / ::mem::size_of::<::c_int>()
715+
size_of::<siginfo_fault>() / size_of::<::c_int>()
714716
}
715-
::SIGCLD => ::mem::size_of::<siginfo_sigcld>() / ::mem::size_of::<::c_int>(),
717+
::SIGCLD => size_of::<siginfo_sigcld>() / size_of::<::c_int>(),
716718
::SIGHUP
717719
| ::SIGINT
718720
| ::SIGQUIT
@@ -725,7 +727,7 @@ cfg_if! {
725727
| ::SIGUSR2
726728
| ::SIGPWR
727729
| ::SIGWINCH
728-
| ::SIGURG => ::mem::size_of::<siginfo_kill>() / ::mem::size_of::<::c_int>(),
730+
| ::SIGURG => size_of::<siginfo_kill>() / size_of::<::c_int>(),
729731
_ => SIGINFO_DATA_SIZE,
730732
}
731733
}
@@ -2456,7 +2458,7 @@ const _CMSG_HDR_ALIGNMENT: usize = 8;
24562458
#[cfg(not(target_arch = "sparc64"))]
24572459
const _CMSG_HDR_ALIGNMENT: usize = 4;
24582460

2459-
const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
2461+
const _CMSG_DATA_ALIGNMENT: usize = size_of::<::c_int>();
24602462

24612463
const NEWDEV: ::c_int = 1;
24622464

@@ -2483,7 +2485,7 @@ f! {
24832485
}
24842486

24852487
pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr {
2486-
if ((*mhdr).msg_controllen as usize) < ::mem::size_of::<::cmsghdr>() {
2488+
if ((*mhdr).msg_controllen as usize) < size_of::<::cmsghdr>() {
24872489
0 as *mut ::cmsghdr
24882490
} else {
24892491
(*mhdr).msg_control as *mut ::cmsghdr
@@ -2495,7 +2497,7 @@ f! {
24952497
return ::CMSG_FIRSTHDR(mhdr);
24962498
};
24972499
let next = _CMSG_HDR_ALIGN(
2498-
cmsg as usize + (*cmsg).cmsg_len as usize + ::mem::size_of::<::cmsghdr>(),
2500+
cmsg as usize + (*cmsg).cmsg_len as usize + size_of::<::cmsghdr>(),
24992501
);
25002502
let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize;
25012503
if next > max {
@@ -2506,7 +2508,7 @@ f! {
25062508
}
25072509

25082510
pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
2509-
_CMSG_HDR_ALIGN(::mem::size_of::<::cmsghdr>() as usize + length as usize) as ::c_uint
2511+
_CMSG_HDR_ALIGN(size_of::<::cmsghdr>() as usize + length as usize) as ::c_uint
25102512
}
25112513

25122514
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {

0 commit comments

Comments
 (0)