From 2ec72fb9f0ffab0b7b6d7c1203e34b3d9d2ef953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Wed, 2 Aug 2023 10:33:22 +0100 Subject: [PATCH] chore: improved use structure --- frontends/libretro/src/lib.rs | 15 +++++++-------- src/apu.rs | 2 +- src/cpu.rs | 2 +- src/devices/stdout.rs | 4 ++-- src/dma.rs | 2 +- src/genie.rs | 2 +- src/util.rs | 4 +++- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/frontends/libretro/src/lib.rs b/frontends/libretro/src/lib.rs index c7ba8d99..97e2193b 100644 --- a/frontends/libretro/src/lib.rs +++ b/frontends/libretro/src/lib.rs @@ -2,14 +2,6 @@ pub mod consts; -use std::{ - collections::HashMap, - ffi::CStr, - fmt::{self, Display, Formatter}, - os::raw::{c_char, c_float, c_uint, c_void}, - slice::from_raw_parts, -}; - use boytacean::{ debugln, gb::{AudioProvider, GameBoy}, @@ -25,6 +17,13 @@ use consts::{ RETRO_DEVICE_ID_JOYPAD_START, RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_X, RETRO_DEVICE_ID_JOYPAD_Y, RETRO_DEVICE_JOYPAD, }; +use std::{ + collections::HashMap, + ffi::CStr, + fmt::{self, Display, Formatter}, + os::raw::{c_char, c_float, c_uint, c_void}, + slice::from_raw_parts, +}; use crate::consts::{REGION_NTSC, RETRO_API_VERSION}; diff --git a/src/apu.rs b/src/apu.rs index 5d119612..ab739a6d 100644 --- a/src/apu.rs +++ b/src/apu.rs @@ -1072,7 +1072,7 @@ impl Default for Apu { #[cfg(test)] mod tests { - use super::*; + use super::Apu; #[test] fn test_trigger_ch1() { diff --git a/src/cpu.rs b/src/cpu.rs index fad2c356..74bc9302 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -588,7 +588,7 @@ impl Default for Cpu { #[cfg(test)] mod tests { - use crate::cpu::Cpu; + use super::Cpu; #[test] fn test_cpu_clock() { diff --git a/src/devices/stdout.rs b/src/devices/stdout.rs index 75dbcd27..f51734d3 100644 --- a/src/devices/stdout.rs +++ b/src/devices/stdout.rs @@ -1,10 +1,10 @@ -use crate::serial::SerialDevice; - use std::{ fmt::{self, Display, Formatter}, io::{stdout, Write}, }; +use crate::serial::SerialDevice; + pub struct StdoutDevice { flush: bool, callback: fn(buffer: &Vec<u8>), diff --git a/src/dma.rs b/src/dma.rs index 9e048b59..a7cfb8a9 100644 --- a/src/dma.rs +++ b/src/dma.rs @@ -119,7 +119,7 @@ impl Default for Dma { #[cfg(test)] mod tests { - use crate::dma::{Dma, DmaMode}; + use super::{Dma, DmaMode}; #[test] fn test_dma_default() { diff --git a/src/genie.rs b/src/genie.rs index 9f775153..9d220933 100644 --- a/src/genie.rs +++ b/src/genie.rs @@ -198,7 +198,7 @@ impl Display for GameGenieCode { #[cfg(test)] mod tests { - use crate::genie::GameGenieCode; + use super::GameGenieCode; #[test] fn test_from_code() { diff --git a/src/util.rs b/src/util.rs index 11d791b5..59770ba4 100644 --- a/src/util.rs +++ b/src/util.rs @@ -46,7 +46,9 @@ pub fn replace_ext(path: &str, new_extension: &str) -> Option<String> { #[cfg(test)] mod tests { - use super::*; + use std::path::Path; + + use super::replace_ext; #[test] fn test_change_extension() { -- GitLab