diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index c041d0a6fb..f9c963dd47 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -1197,7 +1197,7 @@ impl Pal for Sys { )?; let timer_ptr = timer_buf as *mut timer_internal_t; - let timer_st = (&mut *timer_ptr); + let timer_st = &mut *timer_ptr; timer_st.clockid = clock_id; timer_st.timerfd = timerfd.take(); @@ -1273,7 +1273,7 @@ impl Pal for Sys { timer_st.next_wake_time = { let mut val = value.clone(); if flags & TIMER_ABSTIME == 0 { - val.it_value = timespec::add(now, val.it_value).ok_or((Errno(EINVAL)))?; + val.it_value = timespec::add(now, val.it_value).ok_or(Errno(EINVAL))?; } val }; diff --git a/src/start.rs b/src/start.rs index 2e67df5b4b..74ed74aded 100644 --- a/src/start.rs +++ b/src/start.rs @@ -22,7 +22,7 @@ pub struct Stack { impl Stack { pub fn argv(&self) -> *const *const c_char { - &self.argv0 as *const _ + ptr::from_ref(&self.argv0) } pub fn envp(&self) -> *const *const c_char { @@ -35,7 +35,7 @@ impl Stack { while !(*envp).is_null() { envp = envp.add(1); } - envp.add(1) as *const (usize, usize) + envp.add(1).cast::<(usize, usize)>() } } } @@ -49,7 +49,7 @@ unsafe fn copy_string_array(array: *const *const c_char, len: usize) -> Vec<*mut len += 1; } - let buf = unsafe { platform::alloc(len + 1) } as *mut c_char; + let buf = unsafe { platform::alloc(len + 1) }.cast::(); for i in 0..=len { unsafe { *buf.add(i) = *item.add(i) }; } @@ -197,7 +197,7 @@ pub unsafe extern "C" fn relibc_start_v1( unsafe { platform::inner_argv.unsafe_set(copy_string_array(argv, argc as usize)) }; unsafe { platform::argv = platform::inner_argv.unsafe_mut().as_mut_ptr() }; // Special code for program_invocation_name and program_invocation_short_name - if let Some(arg) = unsafe { platform::inner_argv.unsafe_ref() }.get(0) { + if let Some(arg) = unsafe { platform::inner_argv.unsafe_ref() }.first() { unsafe { platform::program_invocation_name = *arg }; unsafe { platform::program_invocation_short_name = libgen::basename(*arg) }; } diff --git a/src/sync/mod.rs b/src/sync/mod.rs index 93bcab0ff3..559628d013 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -29,6 +29,7 @@ use crate::{ use core::{ mem::MaybeUninit, ops::Deref, + ptr, sync::atomic::{self, AtomicI32, AtomicI32 as AtomicInt, AtomicU32}, }; @@ -78,7 +79,7 @@ impl FutexAtomicTy for AtomicU32 { // AtomicU32::as_mut_ptr internally calls UnsafeCell::get, which itself simply does (&self // as *const Self as *mut Self). - self as *const AtomicU32 as *mut u32 + ptr::from_ref::(self) as *mut u32 } } impl FutexAtomicTy for AtomicI32 { @@ -92,7 +93,7 @@ impl FutexAtomicTy for AtomicI32 { #[cfg(target_os = "linux")] return AtomicI32::as_mut_ptr(self);*/ - self as *const AtomicI32 as *mut i32 + ptr::from_ref::(self) as *mut i32 } } @@ -212,9 +213,9 @@ impl AtomicLock { /// A general way to efficiently wait for what might be a long time, using two closures: /// /// - `attempt` = Attempt to modify the atomic value to any - /// desired state. + /// desired state. /// - `mark_long` = Attempt to modify the atomic value to sign - /// that it want's to get notified when waiting is done. + /// that it want's to get notified when waiting is done. /// /// Both of these closures are allowed to spuriously give a /// non-success return value, they are used only as optimization