Consistently use Self as return type

This commit is contained in:
Michael Kohl 2021-04-08 18:19:07 +07:00
parent e51bd4a8e2
commit 9fce6f97dc
6 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ pub struct Screen {
}
impl Screen {
pub fn new() -> Screen {
pub fn new() -> Self {
Screen {
pixels: [[false; WIDTH]; HEIGHT],
}

View File

@ -19,7 +19,7 @@ pub struct Chip8 {
}
impl Chip8 {
pub fn new(audio_subsystem: &AudioSubsystem) -> Chip8 {
pub fn new(audio_subsystem: &AudioSubsystem) -> Self {
Chip8 {
memory: Memory::new(),
registers: Registers::new(),

View File

@ -7,7 +7,7 @@ pub struct Keyboard {
}
impl Keyboard {
pub fn new() -> Keyboard {
pub fn new() -> Self {
Keyboard {
keyboard: [false; KEYS],
}

View File

@ -35,7 +35,7 @@ fn copy_default_char_set(memory: &mut Memory) {
}
impl Memory {
pub fn new() -> Memory {
pub fn new() -> Self {
let mut memory = Memory {
memory: [0; MEMORY_SIZE],
};

View File

@ -60,7 +60,7 @@ pub struct Registers {
}
impl Registers {
pub fn new() -> Registers {
pub fn new() -> Self {
Registers {
data: [0; DATA_REGISTERS],
i: 0,

View File

@ -5,7 +5,7 @@ pub struct Stack {
}
impl Stack {
pub fn new() -> Stack {
pub fn new() -> Self {
Stack {
stack: [0; STACK_DEPTH],
}