diff --git a/Cargo.toml b/Cargo.toml index 9b94043323..f7ce1d3877 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,7 @@ irrefutable_let_patterns = "deny" non_camel_case_types = "allow" unpredictable_function_pointer_comparisons = "deny" unsafe_op_in_unsafe_fn = "deny" +unused_mut = "deny" [lints.rust] dangling_pointers_from_temporaries = "deny" @@ -50,6 +51,7 @@ irrefutable_let_patterns = "deny" non_camel_case_types = "allow" unpredictable_function_pointer_comparisons = "deny" unsafe_op_in_unsafe_fn = "deny" +unused_mut = "deny" [build-dependencies] cc = "1" diff --git a/src/header/glob/mod.rs b/src/header/glob/mod.rs index 4b6718445c..e71561a9d0 100644 --- a/src/header/glob/mod.rs +++ b/src/header/glob/mod.rs @@ -9,10 +9,10 @@ use alloc::{boxed::Box, vec::Vec}; use crate::{ c_str::{CStr, CString}, header::{ - dirent::{DIR, closedir, opendir, readdir}, + dirent::{closedir, opendir, readdir}, errno::*, fnmatch::{FNM_NOESCAPE, FNM_PERIOD, fnmatch}, - sys_stat::{S_IFDIR, S_IFLNK, S_IFMT, stat}, + sys_stat::{S_IFDIR, S_IFMT, stat}, }, platform::{ self, @@ -200,7 +200,7 @@ fn list_dir( } else { path }; - let mut dir = unsafe { opendir(open_path.as_ptr()) }; + let dir = unsafe { opendir(open_path.as_ptr()) }; if dir.is_null() { let new_errno = platform::ERRNO.get(); @@ -295,7 +295,7 @@ fn inner_glob( }; // Get the next section of the glob expression (up to non-escaped '/') - let mut glob_iter = glob_expr.to_bytes(); + let glob_iter = glob_expr.to_bytes(); let mut in_bracket = false; let mut escaped = false; let mut glob_consumed = 0; diff --git a/src/header/grp/mod.rs b/src/header/grp/mod.rs index 957d98ecc6..1a7e486095 100644 --- a/src/header/grp/mod.rs +++ b/src/header/grp/mod.rs @@ -4,14 +4,12 @@ use core::{ cell::SyncUnsafeCell, - convert::{TryFrom, TryInto}, + convert::TryInto, mem::{self, MaybeUninit}, num::ParseIntError, ops::{Deref, DerefMut}, pin::Pin, - primitive::str, ptr, slice, - str::Matches, }; use alloc::{ @@ -20,14 +18,12 @@ use alloc::{ }; use crate::{ - c_str::CStr, fs::File, header::{errno, fcntl, limits, string::strlen, unistd}, io, io::{BufReader, Lines, prelude::*}, platform, platform::types::{c_char, c_int, c_void, gid_t, size_t}, - sync::Mutex, }; use super::{errno::*, string::strncmp}; @@ -158,7 +154,7 @@ fn split(buf: &mut [u8]) -> Option { } fn parse_grp(line: String, destbuf: Option) -> Result { - let mut buffer = line.to_owned().into_bytes(); + let buffer = line.to_owned().into_bytes(); let mut buffer = buffer .into_iter() @@ -385,7 +381,7 @@ pub unsafe extern "C" fn getgrnam_r( for line in BufReader::new(db).lines() { let Ok(line) = line else { return EINVAL }; - let Ok(mut grp) = parse_grp( + let Ok(grp) = parse_grp( line, Some(DestBuffer { ptr: buffer as *mut u8, @@ -461,7 +457,7 @@ pub unsafe extern "C" fn endgrent() { /// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn setgrent() { - let mut line_reader = unsafe { &mut *LINE_READER.get() }; + let line_reader = unsafe { &mut *LINE_READER.get() }; let Ok(db) = File::open(GROUP_FILE.into(), fcntl::O_RDONLY) else { return; }; @@ -479,7 +475,7 @@ pub unsafe extern "C" fn getgrouplist( groups: *mut gid_t, ngroups: *mut c_int, ) -> c_int { - let mut grps = unsafe { + let grps = unsafe { slice::from_raw_parts_mut(groups.cast::>(), ngroups.read() as usize) }; diff --git a/src/header/locale/mod.rs b/src/header/locale/mod.rs index 948fbc92c4..34bbe74448 100644 --- a/src/header/locale/mod.rs +++ b/src/header/locale/mod.rs @@ -11,8 +11,7 @@ use crate::{ fs::File, header::{errno, fcntl}, io::Read, - platform::types::{c_char, c_int, c_void}, - sync::Once, + platform::types::{c_char, c_int}, }; // Can't use &str because of the mutability @@ -58,7 +57,7 @@ pub unsafe extern "C" fn setlocale(category: c_int, locale: *const c_char) -> *m let new_global = GlobalLocaleData::new(); unsafe { GLOBAL_LOCALE = Box::into_raw(new_global) }; }; - let Some(mut global) = (unsafe { GLOBAL_LOCALE.as_mut() }) else { + let Some(global) = (unsafe { GLOBAL_LOCALE.as_mut() }) else { return ptr::null_mut(); }; diff --git a/src/header/netdb/mod.rs b/src/header/netdb/mod.rs index c0a41b96d4..546c65fcac 100644 --- a/src/header/netdb/mod.rs +++ b/src/header/netdb/mod.rs @@ -372,7 +372,7 @@ pub unsafe extern "C" fn gethostbyname(name: *const c_char) -> *mut hostent { } } - let mut host = match lookup_host(name_str) { + let host = match lookup_host(name_str) { Ok(lookuphost) => lookuphost, Err(e) => { H_ERRNO.set(NO_RECOVERY); @@ -403,7 +403,7 @@ pub unsafe extern "C" fn gethostbyname(name: *const c_char) -> *mut hostent { unsafe { HOST_ENTRY = hostent { - h_name: unsafe { HOST_NAME.unsafe_mut().as_mut().unwrap().as_mut_ptr() } as *mut c_char, + h_name: HOST_NAME.unsafe_mut().as_mut().unwrap().as_mut_ptr() as *mut c_char, h_aliases: host_aliases.as_mut_slice().as_mut_ptr(), h_addrtype: AF_INET, h_length: 4, @@ -490,10 +490,7 @@ pub unsafe extern "C" fn getnetent() -> *mut netent { unsafe { NET_ENTRY = netent { - n_name: unsafe { NET_NAME.unsafe_mut() } - .as_mut() - .unwrap() - .as_mut_ptr() as *mut c_char, + n_name: NET_NAME.unsafe_mut().as_mut().unwrap().as_mut_ptr() as *mut c_char, n_aliases: net_aliases.as_mut_slice().as_mut_ptr(), n_addrtype: AF_INET, n_net: NET_ADDR.unwrap() as c_ulong, @@ -606,16 +603,14 @@ pub unsafe extern "C" fn getprotoent() -> *mut protoent { unsafe { PROTO_ENTRY = protoent { - p_name: unsafe { - PROTO_NAME - .unsafe_mut() - .as_mut() - .unwrap() - .as_mut_slice() - .as_mut_ptr() - } as *mut c_char, + p_name: PROTO_NAME + .unsafe_mut() + .as_mut() + .unwrap() + .as_mut_slice() + .as_mut_ptr() as *mut c_char, p_aliases: proto_aliases.as_mut_slice().as_mut_ptr() as *mut *mut c_char, - p_proto: unsafe { PROTO_NUM }.unwrap(), + p_proto: PROTO_NUM.unwrap(), } }; if unsafe { PROTO_STAYOPEN } == 0 { diff --git a/src/header/poll/mod.rs b/src/header/poll/mod.rs index c09149161b..f71d2135a4 100644 --- a/src/header/poll/mod.rs +++ b/src/header/poll/mod.rs @@ -5,7 +5,6 @@ use core::{mem, ptr, slice}; use crate::{ - error::ResultExt, fs::File, header::{ errno::EBADF, @@ -68,7 +67,7 @@ pub unsafe fn poll_epoll(fds: &mut [pollfd], timeout: c_int, sigmask: *const sig let mut closed = 0; for i in 0..fds.len() { - let mut pfd = &mut fds[i]; + let pfd = &mut fds[i]; pfd.revents = 0; @@ -145,7 +144,7 @@ pub unsafe extern "C" fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> trace_expr!( unsafe { poll_epoll( - unsafe { slice::from_raw_parts_mut(fds, nfds as usize) }, + slice::from_raw_parts_mut(fds, nfds as usize), timeout, ptr::null_mut(), ) @@ -178,7 +177,7 @@ pub unsafe extern "C" fn ppoll( trace_expr!( unsafe { poll_epoll( - unsafe { slice::from_raw_parts_mut(fds, nfds as usize) }, + slice::from_raw_parts_mut(fds, nfds as usize), timeout, sigmask, ) diff --git a/src/header/regex/mod.rs b/src/header/regex/mod.rs index 2aa348c27b..5978dddc24 100644 --- a/src/header/regex/mod.rs +++ b/src/header/regex/mod.rs @@ -7,7 +7,7 @@ use crate::{ platform::types::{c_char, c_int, c_void, size_t}, }; use alloc::{borrow::Cow, boxed::Box}; -use core::{mem, ptr, slice}; +use core::{ptr, slice}; use posix_regex::{PosixRegex, PosixRegexBuilder, compile::Error as CompileError, tree::Tree}; /// See . @@ -63,7 +63,7 @@ pub unsafe extern "C" fn regcomp(out: *mut regex_t, pat: *const c_char, cflags: .compile_tokens(); match res { - Ok(mut branches) => { + Ok(branches) => { let re_nsub = PosixRegex::new(Cow::Borrowed(&branches)).count_groups(); unsafe { *out = regex_t { diff --git a/src/header/shadow/mod.rs b/src/header/shadow/mod.rs index 3619fc6c8a..a2537eae92 100644 --- a/src/header/shadow/mod.rs +++ b/src/header/shadow/mod.rs @@ -1,7 +1,5 @@ use core::{ cell::SyncUnsafeCell, - convert::TryInto, - mem, ops::{Deref, DerefMut}, pin::Pin, ptr, @@ -13,7 +11,7 @@ use alloc::{boxed::Box, string::String, vec::Vec}; use crate::{ c_str::CStr, fs::File, - header::{errno, fcntl, string::strlen}, + header::fcntl, io::{BufReader, Lines, prelude::*}, platform, platform::types::{c_char, c_int, c_long, c_ulong, size_t}, @@ -237,7 +235,7 @@ pub unsafe extern "C" fn getspnam_r( #[unsafe(no_mangle)] pub unsafe extern "C" fn setspent() { - let mut line_reader = unsafe { &mut *LINE_READER.get() }; + let line_reader = unsafe { &mut *LINE_READER.get() }; if let Ok(db) = File::open(SHADOW_FILE.into(), fcntl::O_RDONLY) { *line_reader = Some(BufReader::new(db).lines()); } diff --git a/src/header/stdio/default.rs b/src/header/stdio/default.rs index 92ec5fdc89..36ef4bf5d7 100644 --- a/src/header/stdio/default.rs +++ b/src/header/stdio/default.rs @@ -1,13 +1,7 @@ use super::{BUFSIZ, Buffer, FILE, constants}; use core::{cell::UnsafeCell, ptr}; -use crate::{ - fs::File, - header::pthread, - io::LineWriter, - platform::types::c_int, - sync::{Mutex, Once}, -}; +use crate::{fs::File, header::pthread, io::LineWriter, platform::types::c_int, sync::Once}; use alloc::{boxed::Box, vec::Vec}; // TODO: Change FILE to allow const fn initialization? @@ -17,7 +11,7 @@ impl GlobalFile { fn new(file: c_int, flags: c_int) -> Self { let file = File::new(file); let writer = Box::new(LineWriter::new(unsafe { file.get_ref() })); - let mut mutex_attr = pthread::RlctMutexAttr { + let mutex_attr = pthread::RlctMutexAttr { ty: pthread::PTHREAD_MUTEX_RECURSIVE, ..Default::default() }; diff --git a/src/header/stdio/helpers.rs b/src/header/stdio/helpers.rs index 13dd61a87b..d070673b0a 100644 --- a/src/header/stdio/helpers.rs +++ b/src/header/stdio/helpers.rs @@ -9,7 +9,7 @@ use crate::{ error::Errno, fs::File, header::{ - errno::{self, EINVAL}, + errno::EINVAL, fcntl::{ F_GETFL, F_SETFD, F_SETFL, FD_CLOEXEC, O_APPEND, O_CLOEXEC, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, fcntl, @@ -17,11 +17,7 @@ use crate::{ pthread, }, io::BufWriter, - platform::{ - self, - types::{c_int, c_ulonglong}, - }, - sync::Mutex, + platform::types::{c_int, c_ulonglong}, }; use alloc::vec::Vec; @@ -79,7 +75,7 @@ pub fn _fdopen(fd: c_int, mode: CStr) -> Result, Errno> { let file = File::new(fd); let writer = Box::new(BufWriter::new(unsafe { file.get_ref() })); - let mut mutex_attr = pthread::RlctMutexAttr { + let mutex_attr = pthread::RlctMutexAttr { ty: pthread::PTHREAD_MUTEX_RECURSIVE, ..Default::default() }; diff --git a/src/header/string/mod.rs b/src/header/string/mod.rs index 74e6468769..3af60789be 100644 --- a/src/header/string/mod.rs +++ b/src/header/string/mod.rs @@ -2,11 +2,7 @@ //! //! See . -use core::{ - iter::once, - mem::{self, MaybeUninit}, - ptr, slice, usize, -}; +use core::{iter::once, mem, ptr, slice, usize}; use cbitset::BitSet256; @@ -257,7 +253,7 @@ pub unsafe extern "C" fn strcat(s1: *mut c_char, s2: *const c_char) -> *mut c_ch /// containing at least one nul value. The pointed-to buffer must not be /// modified for the duration of the call. #[unsafe(no_mangle)] -pub unsafe extern "C" fn strchr(mut s: *const c_char, c: c_int) -> *mut c_char { +pub unsafe extern "C" fn strchr(s: *const c_char, c: c_int) -> *mut c_char { let c_as_c_char = c as c_char; // We iterate over non-mut references and thus need to coerce the diff --git a/src/header/strings/mod.rs b/src/header/strings/mod.rs index ad1b4b9be4..b6228bf39d 100644 --- a/src/header/strings/mod.rs +++ b/src/header/strings/mod.rs @@ -151,8 +151,7 @@ pub unsafe extern "C" fn strncasecmp(s1: *const c_char, s2: *const c_char, n: si /// Given two zipped `&c_char` iterators, either find the first comparison != 0, or return 0. fn inner_casecmp<'a>(iterator: impl Iterator) -> c_int { - let mut cmp_iter = - iterator.map(|(&c1, &c2)| ctype::tolower(c1.into()) - ctype::tolower(c2.into())); + let cmp_iter = iterator.map(|(&c1, &c2)| ctype::tolower(c1.into()) - ctype::tolower(c2.into())); let mut skip_iter = cmp_iter.skip_while(|&cmp| cmp == 0); skip_iter.next().or(Some(0)).unwrap() } diff --git a/src/header/sys_ioctl/redox/drm.rs b/src/header/sys_ioctl/redox/drm.rs index 3d460bf48a..850ac5b88a 100644 --- a/src/header/sys_ioctl/redox/drm.rs +++ b/src/header/sys_ioctl/redox/drm.rs @@ -74,7 +74,7 @@ impl Dev { Ok(res as c_int) } - unsafe fn write_ioctl(&self, mut buf: IoctlBuffer, func: u64) -> Result { + unsafe fn write_ioctl(&self, buf: IoctlBuffer, func: u64) -> Result { let data = unsafe { buf.read::() }?; let wire = unsafe { data.write() }; let res = redox_rt::sys::sys_call_wo( diff --git a/src/header/sys_syslog/logger.rs b/src/header/sys_syslog/logger.rs index f9662c119b..c16a0f0ba3 100644 --- a/src/header/sys_syslog/logger.rs +++ b/src/header/sys_syslog/logger.rs @@ -1,8 +1,4 @@ -use alloc::{ - borrow::ToOwned, - string::{String, ToString}, - vec::Vec, -}; +use alloc::{borrow::ToOwned, string::String}; use core::{ffi::VaList, ptr::null_mut}; use crate::{ @@ -21,7 +17,7 @@ use crate::{ sync::Mutex, }; -use bitflags::{Flags, bitflags}; +use bitflags::bitflags; use chrono::{DateTime, Utc}; use super::{ @@ -53,7 +49,7 @@ impl LogParams { } } - pub fn write_log(&mut self, priority: Priority, message: CStr<'_>, mut ap: VaList) { + pub fn write_log(&mut self, priority: Priority, message: CStr<'_>, ap: VaList) { if message.is_empty() { return; } diff --git a/src/header/sys_syslog/mod.rs b/src/header/sys_syslog/mod.rs index b75ebb2440..fc994bbcc0 100644 --- a/src/header/sys_syslog/mod.rs +++ b/src/header/sys_syslog/mod.rs @@ -119,7 +119,7 @@ pub unsafe extern "C" fn openlog(ident: *const c_char, opt: c_int, facility: c_i /// /// Non-POSIX, 4.3BSD-Reno. #[unsafe(no_mangle)] -pub unsafe extern "C" fn vsyslog(priority: c_int, message: *const c_char, mut ap: VaList) { +pub unsafe extern "C" fn vsyslog(priority: c_int, message: *const c_char, ap: VaList) { let Some(message) = (unsafe { CStr::from_nullable_ptr(message) }) else { return; }; diff --git a/src/header/unistd/mod.rs b/src/header/unistd/mod.rs index b760c6e653..c2e03718e1 100644 --- a/src/header/unistd/mod.rs +++ b/src/header/unistd/mod.rs @@ -147,7 +147,7 @@ pub unsafe extern "C" fn access(path: *const c_char, mode: c_int) -> c_int { #[unsafe(no_mangle)] pub extern "C" fn alarm(seconds: c_uint) -> c_uint { // TODO setitimer is unimplemented on Redox and obsolete - let mut timer = sys_time::itimerval { + let timer = sys_time::itimerval { it_value: timeval { tv_sec: seconds as time_t, tv_usec: 0, @@ -1035,7 +1035,7 @@ pub unsafe extern "C" fn swab(src: *const c_void, dest: *mut c_void, nbytes: ssi } let number_of_swaps = nbytes / 2; let mut offset = 0; - for i in 0..number_of_swaps { + for _ in 0..number_of_swaps { unsafe { src.offset(offset).copy_to(dest.offset(offset + 1), 1); src.offset(offset + 1).copy_to(dest.offset(offset), 1); diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs index 6613801c7c..06a88f1418 100644 --- a/src/platform/linux/mod.rs +++ b/src/platform/linux/mod.rs @@ -844,7 +844,7 @@ impl Pal for Sys { timerid: timer_t, flags: c_int, value: &itimerspec, - mut ovalue: Option>, + ovalue: Option>, ) -> Result<()> { e_raw(unsafe { syscall!( diff --git a/src/platform/redox/extra.rs b/src/platform/redox/extra.rs index c95e94847f..2939f1a243 100644 --- a/src/platform/redox/extra.rs +++ b/src/platform/redox/extra.rs @@ -21,8 +21,8 @@ pub unsafe extern "C" fn redox_fpath(fd: c_int, buf: *mut c_void, count: size_t) pub fn pipe2(flags: usize) -> syscall::error::Result<[c_int; 2]> { let read_flags = flags | O_RDONLY; let write_flags = flags | O_WRONLY; - let mut read_fd = FdGuard::open("/scheme/pipe", read_flags)?; - let mut write_fd = read_fd.dup(b"write")?; + let read_fd = FdGuard::open("/scheme/pipe", read_flags)?; + let write_fd = read_fd.dup(b"write")?; write_fd.fcntl(F_SETFL, write_flags)?; write_fd.fcntl(F_SETFD, write_flags)?; diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index 707f402dfc..225dde3f10 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -1414,8 +1414,8 @@ impl Pal for Sys { Ok(()) } - fn waitpid(mut pid: pid_t, stat_loc: Option>, options: c_int) -> Result { - let mut res = None; + fn waitpid(pid: pid_t, stat_loc: Option>, options: c_int) -> Result { + let res = None; let mut status = 0; let options = usize::try_from(options) diff --git a/src/platform/redox/path.rs b/src/platform/redox/path.rs index a2b146ac17..e2d1c97424 100644 --- a/src/platform/redox/path.rs +++ b/src/platform/redox/path.rs @@ -149,7 +149,7 @@ pub fn dir_path_and_fd_path(socket_path: &str) -> Result<(String, String)> { let full_path = canonicalize_with_cwd_internal(cwd_guard.as_deref(), socket_path)?; let redox_path = RedoxPath::from_absolute(&full_path).ok_or(Error::new(EINVAL))?; - let (_, mut ref_path) = redox_path.as_parts().ok_or(Error::new(EINVAL))?; + let (_, ref_path) = redox_path.as_parts().ok_or(Error::new(EINVAL))?; if ref_path.as_ref().is_empty() { return Err(Error::new(EINVAL)); } diff --git a/src/platform/redox/signal.rs b/src/platform/redox/signal.rs index f25b188a0e..24267a2c2d 100644 --- a/src/platform/redox/signal.rs +++ b/src/platform/redox/signal.rs @@ -56,7 +56,7 @@ impl PalSignal for Sys { // let fd = FdGuard::new(redox_rt::sys::open(path, syscall::O_RDONLY | syscall::O_CLOEXEC)?); // let count = syscall::read(*fd, &mut spec)?; - let mut spec = syscall::ITimerSpec::default(); + let spec = syscall::ITimerSpec::default(); out.it_interval.tv_sec = spec.it_interval.tv_sec as time_t; out.it_interval.tv_usec = spec.it_interval.tv_nsec / 1000; out.it_value.tv_sec = spec.it_value.tv_sec as time_t; diff --git a/src/platform/redox/socket.rs b/src/platform/redox/socket.rs index 82cd715dad..2fd061915f 100644 --- a/src/platform/redox/socket.rs +++ b/src/platform/redox/socket.rs @@ -568,7 +568,7 @@ impl PalSocket for Sys { let path = format!("{}", str::from_utf8(addr).unwrap()); log::trace!("bind(): path: {:?}", path); - let (dir_path, mut fd_path) = dir_path_and_fd_path(&path)?; + let (dir_path, fd_path) = dir_path_and_fd_path(&path)?; redox_rt::sys::sys_call_wo( socket as usize, @@ -642,7 +642,7 @@ impl PalSocket for Sys { let addr = unsafe { slice::from_raw_parts(&data.sun_path as *const _ as *const u8, len) }; - let mut path = format!("{}", str::from_utf8(addr).unwrap()); + let path = format!("{}", str::from_utf8(addr).unwrap()); log::trace!("connect(): path: {:?}", path); let (_, fd_path) = dir_path_and_fd_path(&path)?; @@ -1122,8 +1122,8 @@ impl PalSocket for Sys { // on any I/O performed. So we don't need to mark this as // nonblocking. - let mut fd0 = listener.dup(b"connect")?; - let mut fd1 = listener.dup(b"listen")?; + let fd0 = listener.dup(b"connect")?; + let fd1 = listener.dup(b"listen")?; sv[0] = fd0.take() as c_int; sv[1] = fd1.take() as c_int; @@ -1136,7 +1136,7 @@ impl PalSocket for Sys { // on any I/O performed. So we don't need to mark this as // nonblocking. - let mut fd0 = listener.dup(b"connect")?; + let fd0 = listener.dup(b"connect")?; sv[0] = fd0.take() as c_int; sv[1] = listener.take() as c_int; diff --git a/src/pthread/mod.rs b/src/pthread/mod.rs index 01dfbc4f7e..b9e1413b02 100644 --- a/src/pthread/mod.rs +++ b/src/pthread/mod.rs @@ -19,6 +19,7 @@ use crate::{ use crate::sync::{Mutex, waitval::Waitval}; /// Called only by the main thread, as part of relibc_start. +#[allow(unused_mut)] pub unsafe fn init() { let mut thread = Pthread { waitval: Waitval::new(), @@ -102,6 +103,7 @@ impl Drop for MmapGuard { } } +#[allow(unused_mut)] pub(crate) unsafe fn create( attrs: Option<&header::RlctAttr>, start_routine: extern "C" fn(arg: *mut c_void) -> *mut c_void, diff --git a/src/sync/pthread_mutex.rs b/src/sync/pthread_mutex.rs index f6482e3f38..8092945d76 100644 --- a/src/sync/pthread_mutex.rs +++ b/src/sync/pthread_mutex.rs @@ -76,7 +76,7 @@ impl RlctMutex { fn lock_inner(&self, deadline: Option<×pec>) -> Result<(), Errno> { let this_thread = os_tid_invalid_after_fork(); - let mut spins_left = SPIN_COUNT; + //let mut spins_left = SPIN_COUNT; loop { let result = self.inner.compare_exchange_weak(