mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
fix: 修复最新版 clippy 告警
This commit is contained in:
@@ -973,15 +973,13 @@ pub fn array_copy_within<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
|
||||
let target = (if rel_target < 0 { (len + rel_target).max(0) } else { rel_target.min(len) }) as usize;
|
||||
let start = (if rel_start < 0 { (len + rel_start).max(0) } else { rel_start.min(len) }) as usize;
|
||||
let end = (if rel_end < 0 { (len + rel_end).max(0) } else { rel_end.min(len) }) as usize;
|
||||
let mut to = target;
|
||||
let len_usize = len as usize;
|
||||
for from in start..end {
|
||||
for (to, from) in (target..).zip(start..end) {
|
||||
if to >= len_usize {
|
||||
break;
|
||||
}
|
||||
let v = arr.get_prop_at(from);
|
||||
arr.set_prop_at(to, v);
|
||||
to += 1;
|
||||
}
|
||||
NativeResult::Ok(vm.reg(args[0]))
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ pub fn date_set_utc_hours<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
|
||||
let h = h_num.trunc() as u32;
|
||||
let min = get_opt_arg(vm, args, 2, ndt.time().minute());
|
||||
let sec = get_opt_arg(vm, args, 3, ndt.time().second());
|
||||
let ms_arg = get_opt_arg(vm, args, 4, ndt.time().nanosecond() as u32 / 1_000_000);
|
||||
let ms_arg = get_opt_arg(vm, args, 4, ndt.time().nanosecond() / 1_000_000);
|
||||
let nd = ndt
|
||||
.with_hour(h)
|
||||
.and_then(|x| x.with_minute(min))
|
||||
@@ -700,7 +700,7 @@ pub fn date_set_utc_minutes<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult
|
||||
}
|
||||
let min = min_num.trunc() as u32;
|
||||
let sec = get_opt_arg(vm, args, 2, ndt.time().second());
|
||||
let ms_arg = get_opt_arg(vm, args, 3, ndt.time().nanosecond() as u32 / 1_000_000);
|
||||
let ms_arg = get_opt_arg(vm, args, 3, ndt.time().nanosecond() / 1_000_000);
|
||||
let nd = ndt
|
||||
.with_minute(min)
|
||||
.and_then(|x| x.with_second(sec))
|
||||
@@ -728,7 +728,7 @@ pub fn date_set_utc_seconds<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult
|
||||
return NativeResult::Ok(JsValue::float(f64::NAN));
|
||||
}
|
||||
let sec = sec_num.trunc() as u32;
|
||||
let ms_arg = get_opt_arg(vm, args, 2, ndt.time().nanosecond() as u32 / 1_000_000);
|
||||
let ms_arg = get_opt_arg(vm, args, 2, ndt.time().nanosecond() / 1_000_000);
|
||||
let nd = ndt
|
||||
.with_second(sec)
|
||||
.and_then(|x| x.with_nanosecond(ms_arg * 1_000_000))
|
||||
|
||||
Reference in New Issue
Block a user