Skip to content

Commit 50f26e0

Browse files
committed
Apply formatting to macro bodies
Run `ci/style.sh` with the changes introduced in [1]. [1]: #4107 (backport <#4107>) This is the `libc-0.2` version of 49cb0ff ("Apply formatting to macro bodies"), though not a direct cherry pick.
1 parent d8ccae5 commit 50f26e0

File tree

105 files changed

+2965
-2801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2965
-2801
lines changed

src/fuchsia/mod.rs

Lines changed: 108 additions & 127 deletions
Large diffs are not rendered by default.

src/fuchsia/x86_64.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ s! {
6060
pub mode: ::mode_t,
6161
pub __seq: ::c_int,
6262
__unused1: ::c_long,
63-
__unused2: ::c_long
63+
__unused2: ::c_long,
6464
}
6565
}
6666

@@ -85,10 +85,10 @@ cfg_if! {
8585
&& self.uc_mcontext == other.uc_mcontext
8686
&& self.uc_sigmask == other.uc_sigmask
8787
&& self
88-
.__private
89-
.iter()
90-
.zip(other.__private.iter())
91-
.all(|(a,b)| a == b)
88+
.__private
89+
.iter()
90+
.zip(other.__private.iter())
91+
.all(|(a, b)| a == b)
9292
}
9393
}
9494
impl Eq for ucontext_t {}

src/psp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ s! {
13831383
pub struct sockaddr {
13841384
pub sa_len: u8,
13851385
pub sa_family: u8,
1386-
pub sa_data: [u8;14],
1386+
pub sa_data: [u8; 14],
13871387
}
13881388

13891389
pub struct in_addr {

src/unix/aix/mod.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ s! {
9494
pub d_ino: ::ino_t,
9595
pub d_reclen: ::c_ushort,
9696
pub d_namlen: ::c_ushort,
97-
pub d_name: [::c_char; 256]
97+
pub d_name: [::c_char; 256],
9898
}
9999

100100
pub struct termios {
101101
pub c_iflag: ::tcflag_t,
102102
pub c_oflag: ::tcflag_t,
103103
pub c_cflag: ::tcflag_t,
104104
pub c_lflag: ::tcflag_t,
105-
pub c_cc: [::cc_t; ::NCCS]
105+
pub c_cc: [::cc_t; ::NCCS],
106106
}
107107

108108
pub struct flock64 {
@@ -139,7 +139,7 @@ s! {
139139
pub f_flag: ::c_ulong,
140140
pub f_namemax: ::c_ulong,
141141
pub f_fstr: [::c_char; 32],
142-
pub f_filler: [::c_ulong; 16]
142+
pub f_filler: [::c_ulong; 16],
143143
}
144144

145145
pub struct lconv {
@@ -180,7 +180,7 @@ s! {
180180
pub tm_year: ::c_int,
181181
pub tm_wday: ::c_int,
182182
pub tm_yday: ::c_int,
183-
pub tm_isdst: ::c_int
183+
pub tm_isdst: ::c_int,
184184
}
185185

186186
pub struct addrinfo {
@@ -196,7 +196,7 @@ s! {
196196
}
197197

198198
pub struct in_addr {
199-
pub s_addr: in_addr_t
199+
pub s_addr: in_addr_t,
200200
}
201201

202202
pub struct ip_mreq_source {
@@ -227,7 +227,7 @@ s! {
227227
pub sin_family: sa_family_t,
228228
pub sin_port: in_port_t,
229229
pub sin_addr: in_addr,
230-
pub sin_zero: [::c_char; 8]
230+
pub sin_zero: [::c_char; 8],
231231
}
232232

233233
pub struct sockaddr_in6 {
@@ -236,7 +236,7 @@ s! {
236236
pub sin6_port: ::uint16_t,
237237
pub sin6_flowinfo: ::uint32_t,
238238
pub sin6_addr: ::in6_addr,
239-
pub sin6_scope_id: ::uint32_t
239+
pub sin6_scope_id: ::uint32_t,
240240
}
241241

242242
pub struct sockaddr_storage {
@@ -250,7 +250,7 @@ s! {
250250
pub struct sockaddr_un {
251251
pub sun_len: ::c_uchar,
252252
pub sun_family: sa_family_t,
253-
pub sun_path: [::c_char; 1023]
253+
pub sun_path: [::c_char; 1023],
254254
}
255255

256256
pub struct st_timespec {
@@ -286,7 +286,7 @@ s! {
286286
pub pw_gid: ::gid_t,
287287
pub pw_gecos: *mut ::c_char,
288288
pub pw_dir: *mut ::c_char,
289-
pub pw_shell: *mut ::c_char
289+
pub pw_shell: *mut ::c_char,
290290
}
291291

292292
pub struct utsname {
@@ -313,7 +313,7 @@ s! {
313313
pub sigev_value: ::sigval,
314314
pub sigev_signo: ::c_int,
315315
pub sigev_notify: ::c_int,
316-
pub sigev_notify_function: extern fn(val: ::sigval),
316+
pub sigev_notify_function: extern "C" fn(val: ::sigval),
317317
pub sigev_notify_attributes: *mut pthread_attr_t,
318318
}
319319

@@ -536,8 +536,8 @@ s! {
536536

537537
s_no_extra_traits! {
538538
pub union __sigaction_sa_union {
539-
pub __su_handler: extern fn(c: ::c_int),
540-
pub __su_sigaction: extern fn(c: ::c_int, info: *mut siginfo_t, ptr: *mut ::c_void),
539+
pub __su_handler: extern "C" fn(c: ::c_int),
540+
pub __su_sigaction: extern "C" fn(c: ::c_int, info: *mut siginfo_t, ptr: *mut ::c_void),
541541
}
542542

543543
pub struct sigaction {
@@ -2514,8 +2514,9 @@ f! {
25142514
if cmsg.is_null() {
25152515
CMSG_FIRSTHDR(mhdr)
25162516
} else {
2517-
if (cmsg as usize + (*cmsg).cmsg_len as usize + ::mem::size_of::<::cmsghdr>()) >
2518-
((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize) {
2517+
if (cmsg as usize + (*cmsg).cmsg_len as usize + ::mem::size_of::<::cmsghdr>())
2518+
> ((*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize)
2519+
{
25192520
0 as *mut ::cmsghdr
25202521
} else {
25212522
// AIX does not have any alignment/padding for ancillary data, so we don't need _CMSG_ALIGN here.
@@ -2546,20 +2547,20 @@ f! {
25462547
let bits = ::mem::size_of::<::c_long>() * 8;
25472548
let fd = fd as usize;
25482549
(*set).fds_bits[fd / bits] |= 1 << (fd % bits);
2549-
return
2550+
return;
25502551
}
25512552

25522553
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
25532554
let bits = ::mem::size_of::<::c_long>() * 8;
25542555
let fd = fd as usize;
25552556
(*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
2556-
return
2557+
return;
25572558
}
25582559

25592560
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
25602561
let bits = ::mem::size_of::<::c_long>() * 8;
25612562
let fd = fd as usize;
2562-
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
2563+
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0;
25632564
}
25642565

25652566
pub fn major(dev: ::dev_t) -> ::c_uint {

src/unix/aix/powerpc64.rs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ s! {
3434
pub f_flag: ::c_ulong,
3535
pub f_namemax: ::c_ulong,
3636
pub f_fstr: [::c_char; 32],
37-
pub f_filler: [::c_ulong; 16]
37+
pub f_filler: [::c_ulong; 16],
3838
}
3939

4040
pub struct pthread_rwlock_t {
@@ -206,14 +206,28 @@ s_no_extra_traits! {
206206
}
207207

208208
pub struct fileops_t {
209-
pub fo_rw: extern fn(file: *mut file, rw: ::uio_rw, io: *mut ::c_void, ext: ::c_long,
210-
secattr: *mut ::c_void) -> ::c_int,
211-
pub fo_ioctl: extern fn(file: *mut file, a: ::c_long, b: ::caddr_t, c: ::c_long,
212-
d: ::c_long) -> ::c_int,
213-
pub fo_select: extern fn(file: *mut file, a: ::c_int, b: *mut ::c_ushort,
214-
c: extern fn()) -> ::c_int,
215-
pub fo_close: extern fn(file: *mut file) -> ::c_int,
216-
pub fo_fstat: extern fn(file: *mut file, sstat: *mut ::stat) -> ::c_int,
209+
pub fo_rw: extern "C" fn(
210+
file: *mut file,
211+
rw: ::uio_rw,
212+
io: *mut ::c_void,
213+
ext: ::c_long,
214+
secattr: *mut ::c_void,
215+
) -> ::c_int,
216+
pub fo_ioctl: extern "C" fn(
217+
file: *mut file,
218+
a: ::c_long,
219+
b: ::caddr_t,
220+
c: ::c_long,
221+
d: ::c_long,
222+
) -> ::c_int,
223+
pub fo_select: extern "C" fn(
224+
file: *mut file,
225+
a: ::c_int,
226+
b: *mut ::c_ushort,
227+
c: extern "C" fn(),
228+
) -> ::c_int,
229+
pub fo_close: extern "C" fn(file: *mut file) -> ::c_int,
230+
pub fo_fstat: extern "C" fn(file: *mut file, sstat: *mut ::stat) -> ::c_int,
217231
}
218232

219233
pub struct file {
@@ -339,10 +353,7 @@ cfg_if! {
339353

340354
impl PartialEq for _kernel_simple_lock {
341355
fn eq(&self, other: &_kernel_simple_lock) -> bool {
342-
unsafe {
343-
self._slock == other._slock
344-
&& self._slockp == other._slockp
345-
}
356+
unsafe { self._slock == other._slock && self._slockp == other._slockp }
346357
}
347358
}
348359
impl Eq for _kernel_simple_lock {}

src/unix/bsd/apple/b32/mod.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ s! {
5252
s_no_extra_traits! {
5353
pub struct pthread_attr_t {
5454
__sig: c_long,
55-
__opaque: [::c_char; 36]
55+
__opaque: [::c_char; 36],
5656
}
5757

5858
pub struct pthread_once_t {
@@ -63,7 +63,7 @@ s_no_extra_traits! {
6363
#[allow(missing_debug_implementations)]
6464
#[repr(align(16))]
6565
pub struct max_align_t {
66-
priv_: [f64; 2]
66+
priv_: [f64; 2],
6767
}
6868
}
6969

@@ -72,18 +72,19 @@ cfg_if! {
7272
impl PartialEq for pthread_attr_t {
7373
fn eq(&self, other: &pthread_attr_t) -> bool {
7474
self.__sig == other.__sig
75-
&& self.__opaque
76-
.iter()
77-
.zip(other.__opaque.iter())
78-
.all(|(a,b)| a == b)
75+
&& self
76+
.__opaque
77+
.iter()
78+
.zip(other.__opaque.iter())
79+
.all(|(a, b)| a == b)
7980
}
8081
}
8182
impl Eq for pthread_attr_t {}
8283
impl ::fmt::Debug for pthread_attr_t {
8384
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
8485
f.debug_struct("pthread_attr_t")
8586
.field("__sig", &self.__sig)
86-
// FIXME: .field("__opaque", &self.__opaque)
87+
// FIXME: .field("__opaque", &self.__opaque)
8788
.finish()
8889
}
8990
}
@@ -96,10 +97,11 @@ cfg_if! {
9697
impl PartialEq for pthread_once_t {
9798
fn eq(&self, other: &pthread_once_t) -> bool {
9899
self.__sig == other.__sig
99-
&& self.__opaque
100-
.iter()
101-
.zip(other.__opaque.iter())
102-
.all(|(a,b)| a == b)
100+
&& self
101+
.__opaque
102+
.iter()
103+
.zip(other.__opaque.iter())
104+
.all(|(a, b)| a == b)
103105
}
104106
}
105107
impl Eq for pthread_once_t {}

src/unix/bsd/apple/b64/aarch64/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ s! {
4747
s_no_extra_traits! {
4848
#[allow(missing_debug_implementations)]
4949
pub struct max_align_t {
50-
priv_: f64
50+
priv_: f64,
5151
}
5252
}

src/unix/bsd/apple/b64/mod.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ s! {
5252
s_no_extra_traits! {
5353
pub struct pthread_attr_t {
5454
__sig: c_long,
55-
__opaque: [::c_char; 56]
55+
__opaque: [::c_char; 56],
5656
}
5757

5858
pub struct pthread_once_t {
@@ -66,18 +66,19 @@ cfg_if! {
6666
impl PartialEq for pthread_attr_t {
6767
fn eq(&self, other: &pthread_attr_t) -> bool {
6868
self.__sig == other.__sig
69-
&& self.__opaque
70-
.iter()
71-
.zip(other.__opaque.iter())
72-
.all(|(a,b)| a == b)
69+
&& self
70+
.__opaque
71+
.iter()
72+
.zip(other.__opaque.iter())
73+
.all(|(a, b)| a == b)
7374
}
7475
}
7576
impl Eq for pthread_attr_t {}
7677
impl ::fmt::Debug for pthread_attr_t {
7778
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
7879
f.debug_struct("pthread_attr_t")
7980
.field("__sig", &self.__sig)
80-
// FIXME: .field("__opaque", &self.__opaque)
81+
// FIXME: .field("__opaque", &self.__opaque)
8182
.finish()
8283
}
8384
}
@@ -90,10 +91,11 @@ cfg_if! {
9091
impl PartialEq for pthread_once_t {
9192
fn eq(&self, other: &pthread_once_t) -> bool {
9293
self.__sig == other.__sig
93-
&& self.__opaque
94-
.iter()
95-
.zip(other.__opaque.iter())
96-
.all(|(a,b)| a == b)
94+
&& self
95+
.__opaque
96+
.iter()
97+
.zip(other.__opaque.iter())
98+
.all(|(a, b)| a == b)
9799
}
98100
}
99101
impl Eq for pthread_once_t {}

0 commit comments

Comments
 (0)