diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index aac3f96..af22517 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -28,3 +28,5 @@ jobs: run: . ~/.bashrc && cargo install cargo-deny - name: Run cargo-deny run: . ~/.bashrc && cargo deny check + - name: Run clippy + run: . ~/.bashrc && cargo clippy -- -Dwarnings diff --git a/kernel/src/cpu/startup.rs b/kernel/src/cpu/startup.rs index e9ce0f8..c31dc54 100644 --- a/kernel/src/cpu/startup.rs +++ b/kernel/src/cpu/startup.rs @@ -57,7 +57,7 @@ pub fn set_cpu_flags() { } let lapic_id = increase_lock_count(); let cpudata_ref = &CPUDATA[lapic_id].lock(); - let cpudata_ref: &CPUData = &cpudata_ref; + let cpudata_ref: &CPUData = cpudata_ref; let cpudata_address = cpudata_ref as *const CPUData as u64; decrease_lock_count(lapic_id); unsafe { diff --git a/kernel/src/sys/acpica_osl.rs b/kernel/src/sys/acpica_osl.rs index 65f00dc..aceda92 100644 --- a/kernel/src/sys/acpica_osl.rs +++ b/kernel/src/sys/acpica_osl.rs @@ -63,7 +63,7 @@ extern "C" fn AcpiOsCreateSemaphore(max: UINT32, initial: UINT32, out: *mut *mut #[no_mangle] extern "C" fn AcpiOsDeleteLock(handle: *mut c_void) { unsafe { - drop(Box::from_raw(handle)); + drop(Box::from_raw(handle as *mut RawSpinlock)); } } #[no_mangle] diff --git a/kernel/src/sys/locks.rs b/kernel/src/sys/locks.rs index 71cd542..aa8f827 100644 --- a/kernel/src/sys/locks.rs +++ b/kernel/src/sys/locks.rs @@ -3,6 +3,7 @@ use lock_api::{GuardSend, Mutex, RawMutex}; use super::sync::RawSpinlock; unsafe impl RawMutex for RawSpinlock { + #[allow(clippy::declare_interior_mutable_const)] const INIT: Self = RawSpinlock::new(); type GuardMarker = GuardSend; diff --git a/kernel/src/sys/sync.rs b/kernel/src/sys/sync.rs index 4ae4ed0..9338370 100644 --- a/kernel/src/sys/sync.rs +++ b/kernel/src/sys/sync.rs @@ -32,9 +32,9 @@ pub fn increase_lock_count() -> usize { if INTERRUPTS_SETUP.load(Ordering::SeqCst) { let lapic_id = get_current_lapic_id(); LOCKS_HELD[lapic_id].fetch_add(1, Ordering::SeqCst); - return lapic_id; + lapic_id } else { - return 0; + 0 } } pub fn decrease_lock_count(lapic_id: usize) {