From 70f9c89c64caa9f3e06c3c18a35157ce89f16162 Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Sun, 25 Feb 2024 05:15:35 +0100 Subject: chore: make clippy happy --- src/arch/x86_64/interrupt/pic_8259.rs | 4 ++-- src/arch/x86_64/mem.rs | 4 ++-- src/arch/x86_64/mod.rs | 2 +- src/machine/keyctrl.rs | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/arch/x86_64/interrupt/pic_8259.rs b/src/arch/x86_64/interrupt/pic_8259.rs index 43a102c..894697c 100644 --- a/src/arch/x86_64/interrupt/pic_8259.rs +++ b/src/arch/x86_64/interrupt/pic_8259.rs @@ -38,9 +38,9 @@ pub fn forbid(interrupt: u8) { pub fn is_masked(interrupt: u8) -> bool { if interrupt < 8 { let val = inb(IMR1); - return val & (interrupt) != 0; + val & (interrupt) != 0 } else { let val = inb(IMR2); - return val & (interrupt - 8) != 0; + val & (interrupt - 8) != 0 } } diff --git a/src/arch/x86_64/mem.rs b/src/arch/x86_64/mem.rs index 52ccdec..bce0c82 100644 --- a/src/arch/x86_64/mem.rs +++ b/src/arch/x86_64/mem.rs @@ -1,14 +1,14 @@ // to detect available memory to initialize PMA // https://wiki.osdev.org/Detecting_Memory_(x86) -use core::arch::asm; use crate::io::*; +use core::arch::asm; extern "C" { fn do_e820(start: usize) -> u32; } // Getting an E820 Memory Map -- osdev wiki -pub fn prob_mem_bios(){ +pub fn prob_mem_bios() { unsafe { let res = do_e820(0x8000); println!("res is {}", res) diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index c3b226e..715c19f 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -1,5 +1,5 @@ pub mod cpu; pub mod interrupt; pub mod io_port; -pub mod misc; pub mod mem; +pub mod misc; diff --git a/src/machine/keyctrl.rs b/src/machine/keyctrl.rs index 40385a2..9284534 100644 --- a/src/machine/keyctrl.rs +++ b/src/machine/keyctrl.rs @@ -56,11 +56,11 @@ impl Prefix { impl KeyState { pub fn new() -> Self { - return Self { + Self { modi: Modifiers::NONE, prefix: Prefix::NONE, scan: None, - }; + } } pub fn toggle_capslock(&mut self) { @@ -174,7 +174,7 @@ impl KeyboardController { // TODO maybe there is a path which leads to invalid SR, e.g. timeout? Some(StatusReg::from_bits_truncate(self.cport.inb())) } - + // this should be called by the interrupt handler prologue pub fn fetch_key(&mut self) { // I'd like to see if this panics.... @@ -185,12 +185,12 @@ impl KeyboardController { } self.update_state(self.dport.inb()); } - + // this should be called by the "epilogue" - pub fn consume_key(&mut self) -> Option{ + pub fn consume_key(&mut self) -> Option { let res = self.gather.clone(); self.gather = None; - return res + res } pub fn decode_key(&mut self) { -- cgit v1.2.3-70-g09d2