From 4e4b92abf28275eff0b607fad1d01dab177db8da Mon Sep 17 00:00:00 2001 From: Kevin Hamacher Date: Tue, 15 Mar 2022 21:26:09 +0100 Subject: [PATCH] cargo clippy --fix --- src/chip.rs | 2 +- src/cpu.rs | 8 ++++---- src/devices/mod.rs | 8 ++++---- src/devices/oscillator.rs | 2 +- src/devices/ram.rs | 2 +- src/devices/usart.rs | 2 +- src/gdbstub.rs | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/chip.rs b/src/chip.rs index b77a352..85c542e 100644 --- a/src/chip.rs +++ b/src/chip.rs @@ -41,7 +41,7 @@ impl Chip { Self { log: log.clone(), cpu: CPU::new(log), - rom: rom, + rom, device_tree: dev_tree, } } diff --git a/src/cpu.rs b/src/cpu.rs index a5f02a5..a41b9d2 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -54,14 +54,14 @@ impl fmt::Display for CPU { write!(f, "-")?; } } - write!(f, "\n")?; + writeln!(f)?; for i in 0..32 { write!(f, " R{:-2}={:02X} ", i, self.registers[i])?; if (i + 1) % 10 == 0 { - write!(f, "\n")?; + writeln!(f)?; } } - write!(f, "\n") + writeln!(f) } } @@ -71,7 +71,7 @@ impl CPU { registers: [0u8; 32], pc: 0, // Reset vector sreg: 0, // Uninitialized as well - logger: logger, + logger, } } diff --git a/src/devices/mod.rs b/src/devices/mod.rs index a2271c2..48f0554 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -22,9 +22,9 @@ pub struct Device { impl Device { pub fn new(device: Box, start_addr: u32, addr_len: u32) -> Self { Self { - start_addr: start_addr, - addr_len: addr_len, - device: device, + start_addr, + addr_len, + device, } } @@ -49,7 +49,7 @@ pub struct DeviceTree { impl DeviceTree { pub fn new(log: Logger) -> Self { Self { - log: log, + log, devices: Vec::new(), } } diff --git a/src/devices/oscillator.rs b/src/devices/oscillator.rs index 850081d..7e5ab5d 100644 --- a/src/devices/oscillator.rs +++ b/src/devices/oscillator.rs @@ -40,7 +40,7 @@ pub struct Oscillator { impl Oscillator { pub fn new(log: Logger) -> Self { Self { - log: log, + log, reg_values: [0u8; 7], ctrl: 0, diff --git a/src/devices/ram.rs b/src/devices/ram.rs index fea1d2e..9379c25 100644 --- a/src/devices/ram.rs +++ b/src/devices/ram.rs @@ -10,7 +10,7 @@ pub struct RAM { impl RAM { pub fn new(log: Logger) -> Self { Self { - log: log, + log, data: Box::new([0u8; 0x4000]), } } diff --git a/src/devices/usart.rs b/src/devices/usart.rs index c3997d3..ce21fad 100644 --- a/src/devices/usart.rs +++ b/src/devices/usart.rs @@ -34,7 +34,7 @@ pub struct USART { impl USART { pub fn new(log: Logger) -> Self { Self { - log: log, + log, status: 0, ctrla: 0, ctrlb: 0, diff --git a/src/gdbstub.rs b/src/gdbstub.rs index fd1e7fd..89a1fac 100644 --- a/src/gdbstub.rs +++ b/src/gdbstub.rs @@ -184,8 +184,8 @@ impl<'a> GDBStub<'a> { pub fn new(log: slog::Logger, chip: &'a mut chip::Chip) -> Self { Self { - log: log, - chip: chip, + log, + chip, breakpoints: HashSet::new(), watchpoints_read: HashSet::new(), watchpoints_write: HashSet::new(),