From d926d1093b78cb7388b606734ee1d9df30eab3f1 Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Tue, 30 Jun 2026 15:23:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=89=88=20clippy=20=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_builtins/src/array.rs | 4 +--- crates/oxide_builtins/src/date.rs | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/oxide_builtins/src/array.rs b/crates/oxide_builtins/src/array.rs index b93e0fcc..df31acf5 100644 --- a/crates/oxide_builtins/src/array.rs +++ b/crates/oxide_builtins/src/array.rs @@ -973,15 +973,13 @@ pub fn array_copy_within(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])) } diff --git a/crates/oxide_builtins/src/date.rs b/crates/oxide_builtins/src/date.rs index b26a52e6..ab9329a0 100644 --- a/crates/oxide_builtins/src/date.rs +++ b/crates/oxide_builtins/src/date.rs @@ -670,7 +670,7 @@ pub fn date_set_utc_hours(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(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(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))