From 34a701bd5c3bec3807870643fcd04a59791ef602 Mon Sep 17 00:00:00 2001 From: TheOddGarlic Date: Mon, 1 Aug 2022 14:09:05 +0300 Subject: [PATCH] unused import: `git::commit_message` `#[warn(unused_imports)]` on by default --- ableos/src/arch/x86_64/init.rs | 2 +- ableos/src/arch/x86_64/interrupts.rs | 14 ++------- ableos/src/channels.rs | 6 ---- ableos/src/handle.rs | 3 +- ableos/src/hardware/mod.rs | 4 --- ableos/src/kmain.rs | 20 +++---------- ableos/src/logger.rs | 11 ++----- ableos/src/relib/image/mono_bitmap.rs | 10 ++----- ableos/src/rhai_shell/mod.rs | 12 ++------ ableos/src/scratchpad.rs | 41 +++++++-------------------- ableos/src/vga_e.rs | 5 +--- ableos/src/vgai.rs | 2 -- ableos/src/vterm.rs | 5 +--- ableos/src/wasm_jumploader/mod.rs | 5 +--- 14 files changed, 32 insertions(+), 108 deletions(-) diff --git a/ableos/src/arch/x86_64/init.rs b/ableos/src/arch/x86_64/init.rs index 8ecb29b7..88344bcd 100644 --- a/ableos/src/arch/x86_64/init.rs +++ b/ableos/src/arch/x86_64/init.rs @@ -1,5 +1,5 @@ // #![allow(clippy::print_literal)] -use super::{drivers::serial, gdt, interrupts}; +use super::{gdt, interrupts}; use crate::{logger, serial_println, TERM}; /// x86_64 initialization diff --git a/ableos/src/arch/x86_64/interrupts.rs b/ableos/src/arch/x86_64/interrupts.rs index 68e9fda2..fff43e2c 100644 --- a/ableos/src/arch/x86_64/interrupts.rs +++ b/ableos/src/arch/x86_64/interrupts.rs @@ -1,17 +1,10 @@ use core::panic::PanicInfo; -use crate::{ - arch::gdt, image::mono_bitmap::bruh, kernel_state::KERNEL_STATE, print, println, - rhai_shell::KEYBUFF, VgaBuffer, SCREEN_BUFFER, -}; +use crate::{arch::gdt, rhai_shell::KEYBUFF, VgaBuffer, SCREEN_BUFFER}; use cpuio::outb; use pic8259::ChainedPics; -use qrcode::{ - render::{string, unicode}, - QrCode, -}; +use qrcode::QrCode; use spin::Lazy; -use vga::colors::Color16; use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; use super::sloop; @@ -156,8 +149,7 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac // warn!("ArrowKeys are unsupported currently"); } - kc => { - + _kc => { // trace!("Unprintable key: {kc:?}"), } }; diff --git a/ableos/src/channels.rs b/ableos/src/channels.rs index 7db1f60e..ab0e73d9 100644 --- a/ableos/src/channels.rs +++ b/ableos/src/channels.rs @@ -1,12 +1,6 @@ -use core::fmt::Display; - use alloc::collections::VecDeque; -use kernel::proccess::PID; - -use crate::{arch::generate_process_pass, handle::Handle}; #[derive(Debug)] - pub struct ChannelPermission { pub owner: bool, pub producer: bool, diff --git a/ableos/src/handle.rs b/ableos/src/handle.rs index 5d35bc51..592cb429 100644 --- a/ableos/src/handle.rs +++ b/ableos/src/handle.rs @@ -1,8 +1,7 @@ //! A handle is a u128 with a set of permissions //! and a resource connected to it -use crate::Path; -use crate::{arch::generate_process_pass, channels::Channel}; +use crate::arch::generate_process_pass; use core::fmt::Display; #[derive(Debug)] diff --git a/ableos/src/hardware/mod.rs b/ableos/src/hardware/mod.rs index 9ef238d8..dd39a864 100644 --- a/ableos/src/hardware/mod.rs +++ b/ableos/src/hardware/mod.rs @@ -1,12 +1,8 @@ use crate::arch::interrupts::InterruptIndex; use crate::arch::interrupts::PICS; use crate::ps2_mouse::{Mouse, MouseState}; -use crate::vga_e::VGAE; use lazy_static::lazy_static; -use log::info; use spin::Mutex; -use vga::colors::Color16; -use vga::writers::GraphicsWriter; use x86_64::instructions::port::PortReadOnly; use x86_64::structures::idt::InterruptStackFrame; diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index 83ee0982..c6193a7b 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -1,26 +1,14 @@ #![allow(clippy::empty_loop)] -use core::sync::atomic::{AtomicU64, Ordering}; +use core::sync::atomic::AtomicU64; -use crate::arch::drivers::sysinfo::master; -use crate::ipc::channel::ChannelMessage; -use crate::ipc::{self, IPC}; -use crate::scheduler::SCHEDULER; -use crate::time::fetch_time; +use crate::arch::{drivers::sysinfo::master, init, sloop}; +use crate::relib::network::socket::{SimpleSock, Socket}; use crate::{ - arch::{init, sloop}, - relib::network::socket::{SimpleSock, Socket}, - scratchpad, + boot_conf::KernelConfig, scheduler::SCHEDULER, scratchpad, systeminfo::RELEASE_TYPE, TERM, }; -use crate::{boot_conf::KernelConfig, systeminfo::RELEASE_TYPE}; -use crate::{hardware, wasm_jumploader, SectionType, TERM}; -use genfs::{Fs, OpenOptions}; use kernel::KERNEL_VERSION; -use libwasm::syscalls::time_calls::get_time; -use qrcode::render::unicode; -use qrcode::QrCode; use spin::Lazy; -use x86_64::instructions::interrupts::{disable, enable}; // TODO: Change this structure to allow for multiple cores loaded pub static KERNEL_CONF: Lazy = Lazy::new(KernelConfig::new); diff --git a/ableos/src/logger.rs b/ableos/src/logger.rs index 9b96df3d..8bc0fd69 100644 --- a/ableos/src/logger.rs +++ b/ableos/src/logger.rs @@ -1,10 +1,6 @@ -use crate::kmain::KERNEL_CONF; -use crate::network::socket::{SimpleSock, Socket}; -use crate::time::fetch_time; -use alloc::borrow::ToOwned; -use lliw::{Fg, Reset}; -use log::{Level, Metadata, Record}; -use log::{LevelFilter, SetLoggerError}; +use crate::{kmain::KERNEL_CONF, time::fetch_time}; +use lliw::Fg; +use log::{Level, LevelFilter, Metadata, Record, SetLoggerError}; static LOGGER: SimpleLogger = SimpleLogger; // TODO: Rebuild this to take advantage of sockets @@ -19,7 +15,6 @@ impl log::Log for SimpleLogger { x86_64::instructions::interrupts::without_interrupts(|| { if self.enabled(record.metadata()) { let time_float = fetch_time(); - use log::Level::*; use Fg::*; let color = match record.level() { diff --git a/ableos/src/relib/image/mono_bitmap.rs b/ableos/src/relib/image/mono_bitmap.rs index 1276d5e1..56c5a79b 100644 --- a/ableos/src/relib/image/mono_bitmap.rs +++ b/ableos/src/relib/image/mono_bitmap.rs @@ -1,10 +1,6 @@ -use crate::{ - graphics::SCREEN_BUFFER, - relib::encoding::rle::{decode, encode}, - vga_e::VGAE, - VgaBuffer, -}; -use shadeable::pixel_format::new_rgba64; +use crate::relib::encoding::rle::{decode, encode}; +use crate::vga_e::VGAE; + use vga::writers::GraphicsWriter; pub fn bruh() { diff --git a/ableos/src/rhai_shell/mod.rs b/ableos/src/rhai_shell/mod.rs index 8c7c768b..ab03642e 100644 --- a/ableos/src/rhai_shell/mod.rs +++ b/ableos/src/rhai_shell/mod.rs @@ -1,12 +1,6 @@ -use crate::arch::drivers::sysinfo::master; -use crate::filesystem::FILE_SYSTEM; -use crate::time::fetch_time; -use crate::wasm_jumploader::interp; -use crate::{ - arch::{shutdown, sloop}, - systeminfo::{KERNEL_VERSION, RELEASE_TYPE}, - KERNEL_STATE, -}; +use crate::arch::{drivers::sysinfo::master, shutdown, sloop}; +use crate::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}; +use crate::{filesystem::FILE_SYSTEM, time::fetch_time, KERNEL_STATE}; use genfs::{Fs, OpenOptions}; use kernel::allocator::ALLOCATOR; use rhai::Engine; diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index dc63ff8e..fd650240 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -1,34 +1,15 @@ -use core::fmt::Error; - -// use crate::aalloc::aalloc; use crate::arch::interrupts::{reset_pit_for_cpu, set_pit_2}; -use crate::arch::{generate_process_pass, shutdown}; -use crate::channels::{Channel, ChannelPermission}; -use crate::devices::pci; -use crate::filesystem::FILE_SYSTEM; -use crate::handle::Handle; -use crate::image::mono_bitmap::bruh; -use crate::ipc::IPC; -use crate::rhai_shell::shell; -use crate::rhai_shell::KEYBUFF; -use crate::unicode_utils::LAMBDA; -use crate::vterm::Term; -use crate::wasm_jumploader::run_program; -use crate::{vgai, SCREEN_BUFFER}; +use crate::{ + arch::shutdown, filesystem::FILE_SYSTEM, rhai_shell::KEYBUFF, vterm::Term, + wasm_jumploader::run_program, +}; + use acpi::{AcpiTables, PlatformInfo}; -use alloc::collections::{vec_deque, VecDeque}; -use cpuio::inb; -use cpuio::outb; +use cpuio::{inb, outb}; use ext2::fs::sync::{DirectoryEntry, Synced}; -use ext2::fs::Ext2; -use ext2::sector::Size1024; -use ext2::sys::inode; -use genfs::OpenOptions; -use genfs::{DirEntry, Fs}; -use kernel::proccess::PID; -use kernel::software_int; +use ext2::{fs::Ext2, sector::Size1024}; +use genfs::{Fs, OpenOptions}; use spin::Lazy; -use vga::writers::GraphicsWriter; // TODO: move to a better place #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -49,8 +30,8 @@ impl acpi::AcpiHandler for AcpiStruct { } pub static TERM: Lazy> = Lazy::new(|| spin::Mutex::new(Term::new())); -#[derive(Debug)] +#[derive(Debug)] pub struct Path { pub path: Vec, } @@ -215,7 +196,7 @@ pub fn sound(n_frequency: u32) { set_pit_2(div); - //And play the sound using the PC speaker + // And play the sound using the PC speaker tmp = inb(0x61); if tmp != (tmp | 3) { outb(tmp | 3, 0x61); @@ -231,7 +212,7 @@ pub fn sound_off() { reset_pit_for_cpu(); } -pub fn list_files_in_dir(fs: &Synced>>, path: &[u8]) -> Vec { +pub fn list_files_in_dir(fs: &Synced>>, _path: &[u8]) -> Vec { let mut entry_list = vec![]; let dirr = fs.read_dir(b"/").unwrap(); diff --git a/ableos/src/vga_e.rs b/ableos/src/vga_e.rs index 0c6091fe..72c0043d 100644 --- a/ableos/src/vga_e.rs +++ b/ableos/src/vga_e.rs @@ -1,7 +1,4 @@ -use vga::{ - colors::Color16, - writers::{Graphics640x480x16, GraphicsWriter}, -}; +use vga::{colors::Color16, writers::Graphics640x480x16}; pub static VGAE_BUFF_OFFSET_X: spin::Mutex = spin::Mutex::new(0); pub static VGAE_BUFF_OFFSET_Y: spin::Mutex = spin::Mutex::new(0); diff --git a/ableos/src/vgai.rs b/ableos/src/vgai.rs index 8abc91ab..18f45d30 100644 --- a/ableos/src/vgai.rs +++ b/ableos/src/vgai.rs @@ -1,5 +1,3 @@ -use vga::writers::{Graphics640x480x16, GraphicsWriter}; - pub enum Color { /// Represents the color `Black (0x0)`. Black = 0x0, diff --git a/ableos/src/vterm.rs b/ableos/src/vterm.rs index 155ec726..d743a6ad 100644 --- a/ableos/src/vterm.rs +++ b/ableos/src/vterm.rs @@ -1,9 +1,6 @@ +use crate::vga_e::VGAE; use vga::{colors::Color16, writers::GraphicsWriter}; -use crate::{ - hardware::{MOUSE, _MOUSE}, - vga_e::VGAE, -}; const TERM_MINUS_ONE_LINE: usize = 4720; const CURSOR_COLOR: Color16 = Color16::Cyan; diff --git a/ableos/src/wasm_jumploader/mod.rs b/ableos/src/wasm_jumploader/mod.rs index fc208e88..ba6047aa 100644 --- a/ableos/src/wasm_jumploader/mod.rs +++ b/ableos/src/wasm_jumploader/mod.rs @@ -2,9 +2,7 @@ pub mod host_functions; use crate::{filesystem::FILE_SYSTEM, wasm_jumploader::host_functions::HostExternals}; use genfs::{Fs, OpenOptions}; -use wasmi::{ - ImportsBuilder, MemoryDescriptor, ModuleImportResolver, ModuleInstance, StackRecycler, -}; +use wasmi::{ImportsBuilder, ModuleInstance}; pub fn interp() { trace!("Interpreting..."); @@ -114,7 +112,6 @@ pub fn run_program(program: &[u8]) { // .expect("failed to instantiate wasm module") - use wasmi::GlobalRef; match instance { Ok(inst) => { let mut instance = inst.assert_no_start();