style: 自动格式化

This commit is contained in:
2026-10-12 18:21:31 +00:00
parent 4345d14a0b
commit 2dc5e1fb9e
5 changed files with 13 additions and 40 deletions
+2 -10
View File
@@ -312,16 +312,8 @@ mod tests {
units: &[u16], alphabet: Base64Alphabet, handling: LastChunkHandling, max_len: Option<usize>,
) -> Result<(usize, Vec<u8>), DecodeError> {
let mut bytes = Vec::new();
decode_base64(
units,
DecodeConfig {
alphabet,
handling,
max_len,
},
&mut |_, b| bytes.push(b),
)
.map(|(r, w)| (r, bytes.into_iter().take(w).collect()))
decode_base64(units, DecodeConfig { alphabet, handling, max_len }, &mut |_, b| bytes.push(b))
.map(|(r, w)| (r, bytes.into_iter().take(w).collect()))
}
fn decode_hex_full(units: &[u16], max_len: Option<usize>) -> Result<(usize, Vec<u8>), DecodeError> {
@@ -15,7 +15,7 @@ use super::common::{
use super::difference::{
add_date_duration, add_days_iso, balance_instant_difference, compare_iso_date, date_duration_sign, date_until_iso,
nudge_iso_difference, nudge_window, plain_date_time_unit_index, round_instant_difference, DifferenceSettings,
IsoDateTime, InternalDuration, DAY_NS, MAX_ISO_DAY,
InternalDuration, IsoDateTime, DAY_NS, MAX_ISO_DAY,
};
use super::instant::{instant_rounding_mode, InstantRoundingMode};
use super::time_zone::zone_offset_seconds;
@@ -1466,10 +1466,7 @@ pub fn duration_round<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
increment,
mode,
};
let start = IsoDateTime {
date: rel,
time_ns: 0,
};
let start = IsoDateTime { date: rel, time_ns: 0 };
let end_dt = IsoDateTime {
date: end,
time_ns: target_time,
@@ -12,8 +12,8 @@ use super::{
make_plain_year_month, month_day_bag_calendar_id, native_engine_error, parse_year_month_difference_settings,
read_iso2, receiver_obj, reject_partial_object_with_calendar_or_time_zone, temporal_constructor_calendar_id,
temporal_number_component, temporal_option_string, temporal_option_value, temporal_overflow,
temporal_to_show_calendar, validate_month_day_annotation_suffix, validate_month_day_time_suffix, ShowCalendar,
IsoDateTime, MAX_ISO_DAY,
temporal_to_show_calendar, validate_month_day_annotation_suffix, validate_month_day_time_suffix, IsoDateTime,
ShowCalendar, MAX_ISO_DAY,
};
/// 读 PlainYearMonth 的 年/月/参考日 三元组(槽 0-2),含 receiver 校验。
@@ -886,10 +886,7 @@ fn plain_year_month_difference<H: VmHost>(vm: &mut H, args: &[u8], since: bool)
}
difference_core(
vm,
IsoDateTime {
date: (ry, rm, 1),
time_ns: 0,
},
IsoDateTime { date: (ry, rm, 1), time_ns: 0 },
IsoDateTime {
date: (i128::from(oy), i128::from(om), 1),
time_ns: 0,
@@ -19,7 +19,7 @@ use super::common::{
use super::difference::{
add_days_iso, bubble_relative_duration, compare_iso_date, date_duration_sign, date_until_iso, difference_core,
internal_duration_sign, nudge_to_calendar_unit, parse_difference_settings, round_instant_difference,
DifferenceSettings, IsoDateTime, InternalDuration, RoundingSpec, DAY_NS, MAX_ISO_DAY, TIME_UNIT_NS,
DifferenceSettings, InternalDuration, IsoDateTime, RoundingSpec, DAY_NS, MAX_ISO_DAY, TIME_UNIT_NS,
};
use super::instant::{
instant_rounding_mode, instant_string_without_annotations, parse_instant_string, primitive_to_bigint,
@@ -1906,16 +1906,14 @@ pub(crate) fn map_add_zoned_error<H: VmHost>(vm: &mut H, error: AddZonedError) -
pub(crate) fn difference_zoned_datetime_with_rounding_vm<H: VmHost>(
vm: &mut H, pair: ZonedPair, settings: DifferenceSettings,
) -> Result<InternalDuration, JsValue> {
difference_zoned_datetime_with_rounding(pair, settings)
.map_err(|error| map_add_zoned_error(vm, error))
difference_zoned_datetime_with_rounding(pair, settings).map_err(|error| map_add_zoned_error(vm, error))
}
/// DifferenceZonedDateTimeWithTotal 的 VM 包装:错误映射为 RangeError。
pub(crate) fn difference_zoned_datetime_with_total_vm<H: VmHost>(
vm: &mut H, pair: ZonedPair, unit: usize,
) -> Result<f64, JsValue> {
difference_zoned_datetime_with_total(pair, unit)
.map_err(|error| map_add_zoned_error(vm, error))
difference_zoned_datetime_with_total(pair, unit).map_err(|error| map_add_zoned_error(vm, error))
}
/// GetISODateTimeFor(规范 11.1.10):epoch 对应的墙历日期时间。
@@ -2182,9 +2180,7 @@ fn nudge_to_zoned_time(
/// # 步骤
/// 1. unit 为时间单位 → TotalTimeDuration 快路径(纳秒差直接除单位长度)。
/// 2. 否则 DifferenceZonedDateTime + TotalRelativeDuration。
pub(crate) fn difference_zoned_datetime_with_total(
pair: ZonedPair, unit: usize,
) -> Result<f64, AddZonedError> {
pub(crate) fn difference_zoned_datetime_with_total(pair: ZonedPair, unit: usize) -> Result<f64, AddZonedError> {
let ns1 = pair.ns1;
let ns2 = pair.ns2;
let time_zone = pair.time_zone;
@@ -2204,8 +2200,7 @@ pub(crate) fn difference_zoned_datetime_with_total(
/// (increment = 1、trunc)取 [[Total]]。
/// 2. 否则 TotalTimeDuration(24h 日折算,zoned 面不可达)。
fn total_relative_duration(
difference: &InternalDuration, origin_ns: i128, dest_ns: i128, iso: IsoDateTime, time_zone: &str,
unit: usize,
difference: &InternalDuration, origin_ns: i128, dest_ns: i128, iso: IsoDateTime, time_zone: &str, unit: usize,
) -> Result<f64, AddZonedError> {
let values = difference.to_values();
// zoned 面时区恒在场:unit ≤ day 恒走日历窗口路径。
+1 -9
View File
@@ -2701,15 +2701,7 @@ fn ta_decode_base64<H: VmHost>(
handling = ta_handling_option(vm, obj, opts_val)?;
}
let units = vm.string_units(string).into_owned();
match crate::ta_codec::decode_base64(
&units,
crate::ta_codec::DecodeConfig {
alphabet,
handling,
max_len,
},
write,
) {
match crate::ta_codec::decode_base64(&units, crate::ta_codec::DecodeConfig { alphabet, handling, max_len }, write) {
Ok(r) => Ok(r),
Err(_) => Err(crate::error::create_syntax_error(vm, "invalid base64 input")),
}