tackle some lints

This commit is contained in:
auronandace
2026-03-10 18:20:06 +00:00
parent 1bed273ad0
commit 8a2bfa2ed5
4 changed files with 13 additions and 9 deletions
+2 -2
View File
@@ -131,11 +131,11 @@ pub unsafe extern "C" fn utimes(path: *const c_char, times: *const timeval) -> c
[
timespec {
tv_sec: unsafe { (*times.offset(0)).tv_sec },
tv_nsec: (unsafe { (*times.offset(0)).tv_usec } as c_long) * 1000,
tv_nsec: c_long::from(unsafe { (*times.offset(0)).tv_usec }) * 1000,
},
timespec {
tv_sec: unsafe { (*times.offset(1)).tv_sec },
tv_nsec: (unsafe { (*times.offset(1)).tv_usec } as c_long) * 1000,
tv_nsec: c_long::from(unsafe { (*times.offset(1)).tv_usec }) * 1000,
},
]
.as_ptr()
+2 -2
View File
@@ -480,7 +480,7 @@ pub unsafe extern "C" fn timelocal(tm: *mut tm) -> time_t {
(*tm).tm_wday = dt.weekday().num_days_from_sunday() as _;
(*tm).tm_yday = dt.ordinal0() as _; // day of year starting at 0
(*tm).tm_isdst = dt.offset().dst_offset().num_hours() as _;
(*tm).tm_gmtoff = dt.offset().fix().local_minus_utc() as _;
(*tm).tm_gmtoff = dt.offset().fix().local_minus_utc().into();
(*tm).tm_zone = tz_name.into_raw().cast();
}
@@ -714,7 +714,7 @@ unsafe fn datetime_to_tm(local_time: &DateTime<Tz>) -> tm {
let offset = local_time.offset();
t.tm_isdst = offset.dst_offset().num_hours() as _;
// Get the UTC offset in seconds
t.tm_gmtoff = offset.fix().local_minus_utc() as _;
t.tm_gmtoff = offset.fix().local_minus_utc().into();
let tm_zone = {
let mut timezone_names = TIMEZONE_NAMES.lock();
+5 -1
View File
@@ -1160,9 +1160,13 @@ pub unsafe extern "C" fn unlink(path: *const c_char) -> c_int {
#[deprecated]
#[unsafe(no_mangle)]
pub extern "C" fn usleep(useconds: useconds_t) -> c_int {
#[cfg(not(target_arch = "x86"))]
let tv_nsec = c_long::from((useconds % 1_000_000) * 1000);
#[cfg(target_arch = "x86")]
let tv_nsec = ((useconds % 1_000_000) * 1000) as c_long;
let rqtp = timespec {
tv_sec: time_t::from(useconds / 1_000_000),
tv_nsec: ((useconds % 1_000_000) * 1000) as c_long,
tv_nsec,
};
let rmtp = ptr::null_mut();
unsafe { Sys::nanosleep(&raw const rqtp, rmtp) }
+4 -4
View File
@@ -561,10 +561,10 @@ impl Linker {
let _ = self.objects.remove(&obj.id).unwrap();
for dep in obj.dependencies() {
if let Some(name) = self.name_to_object_id_map.get(*dep) {
if let Some(object_name) = self.objects.get(name) {
self.unload(ObjectHandle::new(object_name.clone()));
}
if let Some(name) = self.name_to_object_id_map.get(*dep)
&& let Some(object_name) = self.objects.get(name)
{
self.unload(ObjectHandle::new(object_name.clone()));
}
}
self.name_to_object_id_map.remove(&obj.name);