Fix clippy errors

This commit is contained in:
2025-02-24 15:02:44 +00:00
parent 03290e52a3
commit 8d57540566
15 changed files with 121 additions and 58 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ impl Writer {
)
}
pub fn set_font(&mut self, font: &'static Font) {
pub const fn set_font(&mut self, font: &'static Font) {
self.font = font;
}
+13 -10
View File
@@ -17,7 +17,7 @@ static WAKER: AtomicWaker = AtomicWaker::new();
pub fn add_scancode(scancode: u8) {
if let Some(queue) = KBD_QUEUE.get() {
if let Err(_) = queue.push(scancode) {
if queue.push(scancode).is_err() {
println!("WARNING: scancode queue full; dropping keyboard input");
} else {
WAKER.wake();
@@ -34,7 +34,13 @@ pub struct ScancodeStream {
impl ScancodeStream {
pub fn new() -> Self {
KBD_QUEUE.call_once(|| ArrayQueue::new(5));
ScancodeStream { _private: () }
Self { _private: () }
}
}
impl Default for ScancodeStream {
fn default() -> Self {
Self::new()
}
}
@@ -48,15 +54,12 @@ impl Stream for ScancodeStream {
return Poll::Ready(Some(scancode));
}
WAKER.register(&cx.waker());
WAKER.register(cx.waker());
match queue.pop() {
Some(scancode) => {
WAKER.take();
Poll::Ready(Some(scancode))
}
None => Poll::Pending,
}
queue.pop().map_or(Poll::Pending, |scancode| {
WAKER.take();
Poll::Ready(Some(scancode))
})
}
}