From fad9d04640f26a119209acdef6194271f5f65f27 Mon Sep 17 00:00:00 2001 From: aarkegz Date: Thu, 12 Dec 2024 18:56:57 +0800 Subject: [PATCH] fix some warnings --- modules/axhal/src/platform/riscv64_qemu_virt/boot.rs | 2 +- modules/axhal/src/platform/x86_pc/time.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/axhal/src/platform/riscv64_qemu_virt/boot.rs b/modules/axhal/src/platform/riscv64_qemu_virt/boot.rs index 72e8b8a09c..3798e43b33 100644 --- a/modules/axhal/src/platform/riscv64_qemu_virt/boot.rs +++ b/modules/axhal/src/platform/riscv64_qemu_virt/boot.rs @@ -8,7 +8,7 @@ static mut BOOT_STACK: [u8; TASK_STACK_SIZE] = [0; TASK_STACK_SIZE]; #[link_section = ".data.boot_page_table"] static mut BOOT_PT_SV39: [u64; 512] = [0; 512]; -#[warn(clippy::identity_op)] // (0x0 << 10) here makes sense because it's an address +#[allow(clippy::identity_op)] // (0x0 << 10) here makes sense because it's an address unsafe fn init_boot_page_table() { // 0x0000_0000..0x4000_0000, VRWX_GAD, 1G block BOOT_PT_SV39[0] = (0x0 << 10) | 0xef; diff --git a/modules/axhal/src/platform/x86_pc/time.rs b/modules/axhal/src/platform/x86_pc/time.rs index 871ad9c3fb..96d8c5659a 100644 --- a/modules/axhal/src/platform/x86_pc/time.rs +++ b/modules/axhal/src/platform/x86_pc/time.rs @@ -44,7 +44,10 @@ pub fn set_oneshot_timer(deadline_ns: u64) { let now_ns = crate::time::monotonic_time_nanos(); unsafe { if now_ns < deadline_ns { - let apic_ticks = NANOS_TO_LAPIC_TICKS_RATIO.mul_trunc(deadline_ns - now_ns); + let apic_ticks = #[allow(static_mut_refs)] { + // allow static_mut_refs because we're just reading the value + NANOS_TO_LAPIC_TICKS_RATIO.mul_trunc(deadline_ns - now_ns) + }; assert!(apic_ticks <= u32::MAX as u64); lapic.set_timer_initial(apic_ticks.max(1) as u32); } else {