Skip to content

Commit c4eefd5

Browse files
committed
Resolve clippy::zero_ptr
Recent versions of Clippy now lint against `0 as *(const|mut) T` rather than using `null`/`null_mut`. Make the updates required for this to pass.
1 parent 65da4e4 commit c4eefd5

File tree

17 files changed

+26
-26
lines changed

17 files changed

+26
-26
lines changed

src/fuchsia/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@ pub const ST_NOATIME: c_ulong = 1024;
23562356
pub const ST_NODIRATIME: c_ulong = 2048;
23572357

23582358
pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void;
2359-
pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
2359+
pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut();
23602360
pub const RTLD_NODELETE: c_int = 0x1000;
23612361
pub const RTLD_NOW: c_int = 0x2;
23622362

@@ -2500,7 +2500,7 @@ pub const EFD_SEMAPHORE: c_int = 0x1;
25002500

25012501
pub const LOG_NFACILITIES: c_int = 24;
25022502

2503-
pub const SEM_FAILED: *mut crate::sem_t = 0 as *mut sem_t;
2503+
pub const SEM_FAILED: *mut crate::sem_t = ptr::null_mut();
25042504

25052505
pub const RB_AUTOBOOT: c_int = 0x01234567u32 as i32;
25062506
pub const RB_HALT_SYSTEM: c_int = 0xcdef0123u32 as i32;

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ macro_rules! prelude {
8282
#[allow(unused_imports)]
8383
pub(crate) use ::core::prelude::v1::derive;
8484
#[allow(unused_imports)]
85-
pub(crate) use ::core::{fmt, hash, iter, mem};
85+
pub(crate) use ::core::{fmt, hash, iter, mem, ptr};
8686
#[allow(unused_imports)]
8787
pub(crate) use mem::{align_of, align_of_val, size_of, size_of_val};
8888

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,9 +1197,9 @@ pub const _SC_RAW_SOCKETS: c_int = 119;
11971197
pub const _SC_SYMLOOP_MAX: c_int = 120;
11981198
pub const _SC_PHYS_PAGES: c_int = 121;
11991199

1200-
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
1201-
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
1202-
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
1200+
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = ptr::null_mut();
1201+
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut();
1202+
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut();
12031203
pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
12041204
pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;
12051205
pub const PTHREAD_MUTEX_NORMAL: c_int = 3;
@@ -1331,7 +1331,7 @@ pub const B230400: speed_t = 230400;
13311331
pub const EXTA: speed_t = 19200;
13321332
pub const EXTB: speed_t = 38400;
13331333

1334-
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
1334+
pub const SEM_FAILED: *mut sem_t = ptr::null_mut();
13351335

13361336
pub const CRTSCTS: crate::tcflag_t = 0x00030000;
13371337
pub const CCTS_OFLOW: crate::tcflag_t = 0x00010000;

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ pub const B230400: speed_t = 230400;
650650
pub const EXTA: speed_t = 19200;
651651
pub const EXTB: speed_t = 38400;
652652

653-
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
653+
pub const SEM_FAILED: *mut sem_t = ptr::null_mut();
654654

655655
pub const CRTSCTS: crate::tcflag_t = 0x00010000;
656656
pub const CRTS_IFLOW: crate::tcflag_t = CRTSCTS;

src/unix/bsd/netbsdlike/openbsd/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,9 +1321,9 @@ pub const SCHED_RR: c_int = 3;
13211321

13221322
pub const ST_NOSUID: c_ulong = 2;
13231323

1324-
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
1325-
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
1326-
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
1324+
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = ptr::null_mut();
1325+
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut();
1326+
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut();
13271327

13281328
pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 1;
13291329
pub const PTHREAD_MUTEX_RECURSIVE: c_int = 2;

src/unix/cygwin/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ pub const NGROUPS_MAX: c_int = 1024;
10181018
pub const FORK_RELOAD: c_int = 1;
10191019
pub const FORK_NO_RELOAD: c_int = 0;
10201020

1021-
pub const RTLD_DEFAULT: *mut c_void = 0isize as *mut c_void;
1021+
pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut();
10221022
pub const RTLD_LOCAL: c_int = 0;
10231023
pub const RTLD_LAZY: c_int = 1;
10241024
pub const RTLD_NOW: c_int = 2;

src/unix/haiku/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ pub const FD_SETSIZE: c_int = 1024;
10591059
pub const RTLD_LOCAL: c_int = 0x0;
10601060
pub const RTLD_NOW: c_int = 0x1;
10611061
pub const RTLD_GLOBAL: c_int = 0x2;
1062-
pub const RTLD_DEFAULT: *mut c_void = 0isize as *mut c_void;
1062+
pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut();
10631063

10641064
pub const BUFSIZ: c_uint = 8192;
10651065
pub const FILENAME_MAX: c_uint = 256;

src/unix/hurd/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ pub const RB_DEBUGGER: c_int = 0x1000;
17911791

17921792
// semaphore.h
17931793
pub const __SIZEOF_SEM_T: usize = 20;
1794-
pub const SEM_FAILED: *mut crate::sem_t = 0 as *mut sem_t;
1794+
pub const SEM_FAILED: *mut crate::sem_t = ptr::null_mut();
17951795

17961796
// termios.h
17971797
pub const IGNBRK: crate::tcflag_t = 1;
@@ -1962,7 +1962,7 @@ pub const CTIME: u8 = 0;
19621962
pub const CBRK: u8 = 0u8;
19631963

19641964
// dlfcn.h
1965-
pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
1965+
pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut();
19661966
pub const RTLD_NEXT: *mut c_void = -1i64 as *mut c_void;
19671967
pub const RTLD_LAZY: c_int = 1;
19681968
pub const RTLD_NOW: c_int = 2;

src/unix/linux_like/android/b64/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ pub const SA_SIGINFO: c_int = 0x00000004;
225225

226226
pub const RTLD_GLOBAL: c_int = 0x00100;
227227
pub const RTLD_NOW: c_int = 2;
228-
pub const RTLD_DEFAULT: *mut c_void = 0i64 as *mut c_void;
228+
pub const RTLD_DEFAULT: *mut c_void = ptr::null_mut();
229229

230230
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
231231
value: 0,

src/unix/linux_like/android/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ pub const ST_RELATIME: c_ulong = 4096;
15171517
pub const RTLD_NOLOAD: c_int = 0x4;
15181518
pub const RTLD_NODELETE: c_int = 0x1000;
15191519

1520-
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
1520+
pub const SEM_FAILED: *mut sem_t = ptr::null_mut();
15211521

15221522
pub const AI_PASSIVE: c_int = 0x00000001;
15231523
pub const AI_CANONNAME: c_int = 0x00000002;

0 commit comments

Comments
 (0)