chore: remove useless default implementations
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::Cycle;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct DirectMemoryAccess {
|
||||
pub(crate) state: DmaState,
|
||||
cycle: Cycle,
|
||||
@@ -8,6 +8,16 @@ pub(crate) struct DirectMemoryAccess {
|
||||
pub(crate) start: DmaAddress,
|
||||
}
|
||||
|
||||
impl Default for DirectMemoryAccess {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
state: DmaState::Disabled,
|
||||
cycle: Default::default(),
|
||||
start: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DirectMemoryAccess {
|
||||
pub(crate) fn tick(&mut self) -> Option<(u16, u16)> {
|
||||
match self.state {
|
||||
@@ -69,12 +79,6 @@ pub(crate) enum DmaState {
|
||||
Transferring,
|
||||
}
|
||||
|
||||
impl Default for DmaState {
|
||||
fn default() -> Self {
|
||||
Self::Disabled
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub(crate) struct DmaAddress(Option<u16>);
|
||||
|
||||
|
@@ -29,12 +29,6 @@ impl Clone for LCDStatus {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for LCDStatus {
|
||||
fn default() -> Self {
|
||||
Self(0x80) // bit 7 is always 1
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LCDStatus> for u8 {
|
||||
fn from(status: LCDStatus) -> Self {
|
||||
status.0
|
||||
@@ -67,12 +61,6 @@ impl From<PpuMode> for u8 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PpuMode {
|
||||
fn default() -> Self {
|
||||
Self::HBlank
|
||||
}
|
||||
}
|
||||
|
||||
bitfield! {
|
||||
pub struct LCDControl(u8);
|
||||
impl Debug;
|
||||
@@ -93,12 +81,6 @@ impl Clone for LCDControl {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for LCDControl {
|
||||
fn default() -> Self {
|
||||
Self(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for LCDControl {
|
||||
fn from(byte: u8) -> Self {
|
||||
Self(byte)
|
||||
@@ -142,12 +124,6 @@ impl From<TileMapAddress> for u8 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TileMapAddress {
|
||||
fn default() -> Self {
|
||||
Self::X9800
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum TileDataAddress {
|
||||
X8800 = 0,
|
||||
@@ -170,12 +146,6 @@ impl From<TileDataAddress> for u8 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TileDataAddress {
|
||||
fn default() -> Self {
|
||||
Self::X8800
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ObjectSize {
|
||||
Eight = 0,
|
||||
@@ -209,12 +179,6 @@ impl From<ObjectSize> for u8 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ObjectSize {
|
||||
fn default() -> Self {
|
||||
Self::Eight
|
||||
}
|
||||
}
|
||||
|
||||
bitfield! {
|
||||
pub struct BackgroundPalette(u8);
|
||||
impl Debug;
|
||||
@@ -243,12 +207,6 @@ impl Clone for BackgroundPalette {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BackgroundPalette {
|
||||
fn default() -> Self {
|
||||
Self(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for BackgroundPalette {
|
||||
fn from(byte: u8) -> Self {
|
||||
Self(byte)
|
||||
@@ -288,12 +246,6 @@ impl Clone for ObjectPalette {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ObjectPalette {
|
||||
fn default() -> Self {
|
||||
Self(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for ObjectPalette {
|
||||
fn from(byte: u8) -> Self {
|
||||
Self(byte)
|
||||
@@ -361,24 +313,12 @@ impl From<ObjectFlags> for u8 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ObjectFlags {
|
||||
fn default() -> Self {
|
||||
Self(0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ObjectPaletteKind {
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
}
|
||||
|
||||
impl Default for ObjectPaletteKind {
|
||||
fn default() -> Self {
|
||||
Self::Zero
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for ObjectPaletteKind {
|
||||
fn from(byte: u8) -> Self {
|
||||
match byte & 0b01 {
|
||||
@@ -417,12 +357,6 @@ impl From<RenderPriority> for u8 {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for RenderPriority {
|
||||
fn default() -> Self {
|
||||
Self::Object
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum GrayShade {
|
||||
White = 0,
|
||||
@@ -442,12 +376,6 @@ impl GrayShade {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GrayShade {
|
||||
fn default() -> Self {
|
||||
Self::White
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u8> for GrayShade {
|
||||
fn from(byte: u8) -> Self {
|
||||
match byte & 0b11 {
|
||||
|
Reference in New Issue
Block a user