diff --git a/src/lib.rs b/src/lib.rs index 0a317d8..ff482e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,13 +5,14 @@ #![reexport_test_harness_main = "test_main"] #![feature(abi_x86_interrupt)] #![feature(alloc_error_handler)] -#![feature(async_fn_in_trait)] #![feature(async_closure)] #![feature(inherent_associated_types)] #![feature(iter_advance_by)] +#[cfg(test)] +use bootloader::entry_point; -use bootloader::{entry_point, BootInfo}; +use bootloader::BootInfo; use core::panic::PanicInfo; extern crate alloc; diff --git a/src/system/kernel/interrupts.rs b/src/system/kernel/interrupts.rs index 802ba2d..2ef75bb 100644 --- a/src/system/kernel/interrupts.rs +++ b/src/system/kernel/interrupts.rs @@ -38,7 +38,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac }; } - let keyboard = KEYBOARD.lock(); + let _keyboard = KEYBOARD.lock(); let mut port = Port::new(0x60); let scancode: u8 = unsafe { port.read() }; diff --git a/src/system/kernel/render.rs b/src/system/kernel/render.rs index a2b9fdd..3186959 100644 --- a/src/system/kernel/render.rs +++ b/src/system/kernel/render.rs @@ -269,7 +269,7 @@ impl Renderer { if self.col_pos >= BUFFER_WIDTH { self.internal_newline(); } - let row = BUFFER_HEIGHT - 1; + let _row = BUFFER_HEIGHT - 1; let col = self.col_pos; let buff_len = self.term_buffer.len(); diff --git a/src/system/std/time.rs b/src/system/std/time.rs index 3b5e35d..ab34e69 100644 --- a/src/system/std/time.rs +++ b/src/system/std/time.rs @@ -1,8 +1,8 @@ -use cmos_rtc::Time; + use crate::println; use super::super::kernel::interrupts::GLOBALTIMER; use x86_64::instructions::interrupts; -use crate::system::kernel::interrupts::InterruptIndex; + pub fn wait(seconds: f64) { let mut start = 0; diff --git a/src/user/bin/apps/editor.rs b/src/user/bin/apps/editor.rs index c81997d..9cbc97e 100644 --- a/src/user/bin/apps/editor.rs +++ b/src/user/bin/apps/editor.rs @@ -1,6 +1,6 @@ use crate::{serial_println, std}; use crate::std::application::{self, Application}; -use crate::std::io::{Color, ColorCode, Display, KeyStroke, Screen}; +use crate::std::io::{Color, ColorCode, Display, KeyStroke}; use crate::std::render::{ColouredChar, Frame, Position, RenderError}; use crate::user::lib::libgui::cg_core::CgComponent; @@ -169,7 +169,7 @@ impl Application for Editor { } } - async fn run(&mut self, args: Vec) -> Result<(), application::Error> { + async fn run(&mut self, _args: Vec) -> Result<(), application::Error> { // if let Some(s) = args.get(0) { // self.buffer = s.lines().map(|l| l.chars().collect()).collect::>>() diff --git a/src/user/bin/apps/grapher.rs b/src/user/bin/apps/grapher.rs index 8997fd5..6f1316e 100644 --- a/src/user/bin/apps/grapher.rs +++ b/src/user/bin/apps/grapher.rs @@ -6,7 +6,7 @@ use core::any::Any; use async_trait::async_trait; use crate::std::application::{Application, Error}; use crate::std::render::{Frame, Position, Dimensions, ColouredChar, RenderError}; -use crate::std::io::{Display, KeyStroke, Screen, Stdin}; +use crate::std::io::{Display, KeyStroke, Stdin}; use crate::user::lib::libgui::{ cg_core::{CgComponent}, @@ -22,7 +22,7 @@ const OFFSET_Y: i64 = 10; use core::f64::consts::E; use core::f64::consts::PI; -use crate::serial_println; + #[derive(Clone)] pub struct Grapher { @@ -50,7 +50,7 @@ impl Application for Grapher { } } async fn run(&mut self, args: Vec) -> Result<(), Error> { - let d = Display::borrow(); + let _d = Display::borrow(); self.frame.frame = vec![vec![ColouredChar::new(' '); self.frame.dimensions.x]; self.frame.dimensions.y]; @@ -138,10 +138,10 @@ impl Application for Grapher { if let Ok(frame) = container.render() { let self_widget = container.elements.get("grapher").unwrap(); - let self_clone = self_widget.fetch::().unwrap(); + let _self_clone = self_widget.fetch::().unwrap(); let entry = container.elements.get("entry_box").unwrap(); - let entry_clone = entry.fetch::().unwrap(); + let _entry_clone = entry.fetch::().unwrap(); frame.write_to_screen().map_err(|_| Error::ApplicationError(String::from("failed to write to screen")))?; } diff --git a/src/user/bin/games/crystalrpg/game.rs b/src/user/bin/games/crystalrpg/game.rs index 8970d0f..2ccd394 100644 --- a/src/user/bin/games/crystalrpg/game.rs +++ b/src/user/bin/games/crystalrpg/game.rs @@ -1,6 +1,6 @@ -use hashbrown::HashMap; -use crate::user::lib::geometry::Position; + + use super::{map::Map, player::Player}; pub struct Game { diff --git a/src/user/bin/games/gameoflife.rs b/src/user/bin/games/gameoflife.rs index ecf781e..2f31d8d 100644 --- a/src/user/bin/games/gameoflife.rs +++ b/src/user/bin/games/gameoflife.rs @@ -21,9 +21,9 @@ impl Application for GameOfLife { frame: Frame::new(Position::new(0, 0), Dimensions::new(80, 25)).unwrap() } } - async fn run(&mut self, args: Vec) -> Result<(), Error> { + async fn run(&mut self, _args: Vec) -> Result<(), Error> { // setup: - let d = Display::borrow(); + let _d = Display::borrow(); let xoffset = 38; let yoffset = 5; @@ -78,7 +78,7 @@ impl GameOfLife { let mut frame = Frame::new(Position::new(0, 0), Dimensions::new(80, 25)).unwrap(); - self.frame.frame.iter().enumerate().for_each(|(y, row)| row.iter().enumerate().for_each(|(x, chr)| { + self.frame.frame.iter().enumerate().for_each(|(y, row)| row.iter().enumerate().for_each(|(x, _chr)| { frame[y][x] = self.get_new_value(x as u8, y as u8); })); diff --git a/src/user/bin/games/snake.rs b/src/user/bin/games/snake.rs index 428b957..db7ea34 100644 --- a/src/user/bin/games/snake.rs +++ b/src/user/bin/games/snake.rs @@ -47,7 +47,7 @@ impl Application for Game { async fn run(&mut self, args: Vec) -> Result<(), Error> { - let settings = [0, 0, 0]; // ai_count, snake_len, poi_count + let _settings = [0, 0, 0]; // ai_count, snake_len, poi_count if args.len() == 0 { self.gamemode = Gamemode::SinglePlayer; @@ -75,7 +75,7 @@ impl Application for Game { self.prepare(); // switch OS to application mode - let d = Display::borrow(); + let _d = Display::borrow(); // render the initial state of the screen. self.render().map_err(|_| Error::ApplicationError(String::from("failed to render game screen")))?; // run the game @@ -99,19 +99,19 @@ impl Game { } fn respawn_snakes(&mut self) { - if let Gamemode::WithAI(ai_count, snake_len, _poi) = self.gamemode { + if let Gamemode::WithAI(_ai_count, snake_len, _poi) = self.gamemode { self.snakes.push(Snake::ai(self.snakes.len() + 1, snake_len)); } } async fn gameloop(&mut self) -> Result<(), Error> { // main gameloop - let mut all_points: Vec; + let mut _all_points: Vec; 'gameloop: loop { time::wait(0.1); - let mut points: Vec; + let mut _points: Vec; let length = self.snakes.len(); for i in 0..length { @@ -350,7 +350,7 @@ impl PathFinder { } } - fn optimal_move(head: &Position, rel_pos: &Position, moves: &Vec) -> Direction { + fn optimal_move(_head: &Position, rel_pos: &Position, moves: &Vec) -> Direction { let mut optimal_moves = vec![Direction::None; 4]; let x_offset: usize; diff --git a/src/user/bin/shell.rs b/src/user/bin/shell.rs index a11f0b9..d3d1be8 100644 --- a/src/user/bin/shell.rs +++ b/src/user/bin/shell.rs @@ -2,13 +2,11 @@ use lazy_static::lazy_static; use spin::Mutex; use vga::{ - writers::{PrimitiveDrawing, GraphicsWriter, Graphics640x480x16}, - colors::Color16, + writers::{PrimitiveDrawing, GraphicsWriter}, }; // Standard library use alloc::{ - boxed::Box, format, string::{String, ToString}, vec, @@ -21,7 +19,7 @@ use crate::{ println, std::{ application::{Application, Error, Exit}, - time::{timer, wait}, + time::{timer}, io::{Color, write, Screen, Stdin, Serial, KeyStroke, Display}, }, user::{ @@ -212,7 +210,7 @@ async fn exec() -> Result<(), Error> { timer(); } "test_features" => { - let d = Display::borrow(); + let _d = Display::borrow(); setup_ui().await; } _ => { diff --git a/src/user/lib/geometry.rs b/src/user/lib/geometry.rs index 4d73b7c..c8819bd 100644 --- a/src/user/lib/geometry.rs +++ b/src/user/lib/geometry.rs @@ -1,7 +1,7 @@ use alloc::borrow::ToOwned; use alloc::vec::Vec; use libm::sqrt; -use crate::println; + #[derive(Clone, Debug, PartialEq)] pub enum Line { diff --git a/src/user/lib/libgui/cg_widgets.rs b/src/user/lib/libgui/cg_widgets.rs index feff9b7..e98c7c6 100644 --- a/src/user/lib/libgui/cg_widgets.rs +++ b/src/user/lib/libgui/cg_widgets.rs @@ -521,7 +521,7 @@ impl CgComponent for CgDialog { #[async_trait] impl CgKeyboardCapture for CgDialog { - async fn keyboard_capture(&mut self, break_condition: fn(KeyStroke) -> (KeyStroke, Exit), app: Option<&Widget>) -> Result<(Exit, usize), RenderError> { + async fn keyboard_capture(&mut self, break_condition: fn(KeyStroke) -> (KeyStroke, Exit), _app: Option<&Widget>) -> Result<(Exit, usize), RenderError> { loop { let k = break_condition(Stdin::keystroke().await); match k {