From 5c83b493281ca180f3baa47105265b35c3900fcb Mon Sep 17 00:00:00 2001 From: zxq5 Date: Thu, 19 Jun 2025 18:50:57 +0100 Subject: [PATCH] fixed some clippy warns --- assembler/src/parser.rs | 2 +- emulator/src/emulator/system/model.rs | 4 ++-- emulator/src/emulator/system/processor/mod.rs | 2 +- emulator/src/emulator/ui/memory_inspector.rs | 2 +- resources/dsa/fib.dsa | 2 -- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/assembler/src/parser.rs b/assembler/src/parser.rs index 554b0de..fdc95ce 100644 --- a/assembler/src/parser.rs +++ b/assembler/src/parser.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use crate::{ AssembleError, expect_token, expect_type, - model::{Node, Opcode, Token, TokenType}, + model::{Node, Opcode, Token}, node, }; diff --git a/emulator/src/emulator/system/model.rs b/emulator/src/emulator/system/model.rs index 876bffb..76c16f1 100644 --- a/emulator/src/emulator/system/model.rs +++ b/emulator/src/emulator/system/model.rs @@ -233,8 +233,8 @@ pub struct PersistentState { impl PersistentState { pub fn update(&mut self, new_state: &Self) { self.history.extend(new_state.history.clone()); - if self.history.len() > 32768 { - let len = self.history.len() - 32768; + if self.history.len() > 1024 { + let len = self.history.len() - 1024; self.history.drain(..len); } } diff --git a/emulator/src/emulator/system/processor/mod.rs b/emulator/src/emulator/system/processor/mod.rs index 82e5e91..85602b1 100644 --- a/emulator/src/emulator/system/processor/mod.rs +++ b/emulator/src/emulator/system/processor/mod.rs @@ -254,7 +254,7 @@ impl Executable for Instruction { // To populate the lower 16 bits, see LLI. Self::LoadUpperImmediate(a) => { *cpu.reg(a.r1) = - (cpu.get(a.r1) & 0x0000_FFFF) | u32::from(a.immediate) << 16; + (cpu.get(a.r1) & 0x0000_FFFF) | (u32::from(a.immediate) << 16); } // Unconditionally jumps to the calculated address or direct address diff --git a/emulator/src/emulator/ui/memory_inspector.rs b/emulator/src/emulator/ui/memory_inspector.rs index 939bc09..cfd9263 100644 --- a/emulator/src/emulator/ui/memory_inspector.rs +++ b/emulator/src/emulator/ui/memory_inspector.rs @@ -128,7 +128,7 @@ impl Component for MemoryInspector { // combine all 4 bytes in the chunk into a u32 let combined = chunk .iter() - .fold(0u32, |acc, &byte| acc << 8 | u32::from(byte)); + .fold(0u32, |acc, &byte| (acc << 8) | u32::from(byte)); ui.monospace(format!("{combined}")); ui.monospace(format!("{}", Instruction::decode(combined).unwrap_or(Instruction::Nop))); diff --git a/resources/dsa/fib.dsa b/resources/dsa/fib.dsa index 630892c..d51c094 100644 --- a/resources/dsa/fib.dsa +++ b/resources/dsa/fib.dsa @@ -1,5 +1,3 @@ -db fib_count: 10 // How many more numbers to calculate after F(0) and F(1) - fib_n: pop ret pop rg0 // n