Cargo fmt

This commit is contained in:
Speedy_Lex
2026-05-06 23:54:36 +02:00
parent eff610eac6
commit 2d4ab41de5
7 changed files with 29 additions and 21 deletions
+7 -1
View File
@@ -92,7 +92,13 @@ impl<L: LogSink> LogParams<L> {
.unwrap_or(true)
{
// Try reopening the log file once and retrying as musl does.
if !(self.open_logger().is_ok() && self.writer.as_mut().and_then(|w| w.writer().write_all(&buffer).ok()).is_some()) && self.opt.contains(Config::Console)
if !(self.open_logger().is_ok()
&& self
.writer
.as_mut()
.and_then(|w| w.writer().write_all(&buffer).ok())
.is_some())
&& self.opt.contains(Config::Console)
{
// TODO: Log error to /dev/console & Redox equivalent
}
+4 -3
View File
@@ -256,7 +256,7 @@ pub extern "C" fn clock() -> clock_t {
}
let ts = unsafe { ts.assume_init() };
#[expect(clippy::unnecessary_cast, reason="needed on i586")]
#[expect(clippy::unnecessary_cast, reason = "needed on i586")]
let clocks =
ts.tv_sec * CLOCKS_PER_SEC as i64 + (ts.tv_nsec / (1_000_000_000 / CLOCKS_PER_SEC)) as i64;
clock_t::try_from(clocks).unwrap_or(-1)
@@ -851,8 +851,9 @@ unsafe fn set_timezone(
match dst {
Some(dst) => {
guard.1 =
Some(CString::new(dst.offset().abbreviation().expect("Wrong timezone")).unwrap());
guard.1 = Some(
CString::new(dst.offset().abbreviation().expect("Wrong timezone")).unwrap(),
);
tzname.0[1] = guard.1.as_ref().unwrap().as_ptr().cast_mut();
daylight = 1;
}
+1 -4
View File
@@ -835,10 +835,7 @@ mod tests {
let mut reader = BufReader::with_capacity(5, PositionReader { pos: 0 });
assert_eq!(reader.fill_buf().ok(), Some(&[0, 1, 2, 3, 4][..]));
assert_eq!(
reader.seek(SeekFrom::End(-5)).ok(),
Some(u64::MAX - 5)
);
assert_eq!(reader.seek(SeekFrom::End(-5)).ok(), Some(u64::MAX - 5));
assert_eq!(reader.fill_buf().ok().map(|s| s.len()), Some(5));
// the following seek will require two underlying seeks
let expected = 9223372036854775802;
+1 -1
View File
@@ -774,7 +774,7 @@ impl DSO {
let strtab_offset = strtab_offset.expect("mandatory DT_STRTAB not present");
let strtab_size = strtab_size.expect("mandatory DT_STRSZ not present");
#[expect(clippy::unnecessary_cast, reason="needed on i586")]
#[expect(clippy::unnecessary_cast, reason = "needed on i586")]
let dynstrtab = StringTable::new(
mmap,
strtab_offset as u64,
+8 -4
View File
@@ -74,8 +74,10 @@ impl InnerRwLock {
waiting_wr = expected & WAITING_WR;
if actual & COUNT_MASK > 0 {
if crate::sync::futex_wait(&self.state, expected, relative.as_ref()) == super::FutexWaitResult::TimedOut {
return Err(Errno(ETIMEDOUT))
if crate::sync::futex_wait(&self.state, expected, relative.as_ref())
== super::FutexWaitResult::TimedOut
{
return Err(Errno(ETIMEDOUT));
}
} else {
// We must avoid blocking indefinitely in our `futex_wait()`, in this case
@@ -93,8 +95,10 @@ impl InnerRwLock {
pub fn acquire_read_lock(&self, deadline: Option<(&timespec, clockid_t)>) -> Result<(), Errno> {
let relative = Self::translate_timeout(deadline)?;
while let Err(old) = self.try_acquire_read_lock() {
if crate::sync::futex_wait(&self.state, old, relative.as_ref()) == super::FutexWaitResult::TimedOut {
return Err(Errno(ETIMEDOUT))
if crate::sync::futex_wait(&self.state, old, relative.as_ref())
== super::FutexWaitResult::TimedOut
{
return Err(Errno(ETIMEDOUT));
}
}
+5 -6
View File
@@ -35,12 +35,11 @@ impl Semaphore {
return 0;
}
if self.count.compare_exchange_weak(
value,
value - 1,
Ordering::SeqCst,
Ordering::SeqCst,
).is_ok() {
if self
.count
.compare_exchange_weak(value, value - 1, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
// Acquired
return value;
}
+3 -2
View File
@@ -28,8 +28,9 @@ fn find_expected_dir() -> Option<PathBuf> {
if found_expected_dir.is_none()
&& let Ok(check) = env::current_dir().map(|cwd| cwd.join("expected"))
&& check.is_dir(){
found_expected_dir = Some(check);
&& check.is_dir()
{
found_expected_dir = Some(check);
}
found_expected_dir