misc: more clippy fixes, **switched to stable**

The switch was due to rust-analyzer bug on latest nightly, please use stable until [this bug](https://github.com/rust-lang/rust-analyzer/issues/20051) is fixed
This commit is contained in:
2025-06-22 00:42:44 +01:00
parent 1907bbb200
commit bbf893290f
4 changed files with 20 additions and 12 deletions
+6 -6
View File
@@ -108,11 +108,11 @@ impl Parser {
let dest = expect_type!(self.next()?, Register)?; let dest = expect_type!(self.next()?, Register)?;
let mut offset = Token::Immediate(0); let mut offset = Token::Immediate(0);
if let Ok(next) = self.peek_next() if let Ok(next) = self.peek_next() {
&& expect_type!(next, Immediate).is_ok() if expect_type!(next, Immediate).is_ok() {
{
offset = self.next()?; offset = self.next()?;
} }
}
args = vec![base, dest, offset]; args = vec![base, dest, offset];
} }
@@ -120,11 +120,11 @@ impl Parser {
let base = expect_type!(self.next()?, Register)?; let base = expect_type!(self.next()?, Register)?;
let dest = expect_type!(self.next()?, Register, Symbol)?; let dest = expect_type!(self.next()?, Register, Symbol)?;
let mut offset = Token::Immediate(0); let mut offset = Token::Immediate(0);
if let Ok(next) = self.peek_next() if let Ok(next) = self.peek_next() {
&& expect_type!(next, Immediate).is_ok() if expect_type!(next, Immediate).is_ok() {
{
offset = self.next()?; offset = self.next()?;
} }
}
args = vec![base, dest, offset]; args = vec![base, dest, offset];
} }
+5 -1
View File
@@ -7,7 +7,7 @@
//! //!
//! # Configuration //! # Configuration
//! //!
//! This may be disabled like so in your `.dsarc.toml` file: //! This may be disabled like so in your `.dsa.emulator.toml` file:
//! //!
//! ```toml //! ```toml
//! [misc] //! [misc]
@@ -16,6 +16,9 @@
//! //!
//! Alternatively, you can hide this in your Discord settings. //! Alternatively, you can hide this in your Discord settings.
#[cfg(feature = "discord-rpc")]
use std::{path::PathBuf, sync::Arc, time::Duration};
use std::sync::mpsc::{Receiver, Sender}; use std::sync::mpsc::{Receiver, Sender};
#[cfg(feature = "discord-rpc")] #[cfg(feature = "discord-rpc")]
@@ -200,6 +203,7 @@ pub enum Activity {}
/// Gets the discord [`RpcClient`] or returns None if this has been disabled in the config /// Gets the discord [`RpcClient`] or returns None if this has been disabled in the config
/// options. /// options.
#[cfg(feature = "config")] #[cfg(feature = "config")]
#[allow(clippy::needless_pass_by_value, unused_variables)]
pub fn get_rpc_client_or_none( pub fn get_rpc_client_or_none(
config: &Config, config: &Config,
rpc_sender: Sender<Message>, rpc_sender: Sender<Message>,
+4 -1
View File
@@ -5,7 +5,9 @@ use std::{
time::Duration, time::Duration,
}; };
use crate::emulator::misc::rpc::RpcClient; #[allow(unused_imports)]
use crate::emulator::misc::rpc::{Activity, RpcClient};
use crate::emulator::system::{ use crate::emulator::system::{
model::{Command, PersistentState, Running, State}, model::{Command, PersistentState, Running, State},
processor::Processor, processor::Processor,
@@ -14,6 +16,7 @@ use crate::emulator::system::{
use common::prelude::*; use common::prelude::*;
#[expect(clippy::too_many_lines)] #[expect(clippy::too_many_lines)]
#[allow(unused_variables)]
pub fn run_emulator( pub fn run_emulator(
cmd_rx: &Receiver<Command>, cmd_rx: &Receiver<Command>,
state_tx: &Sender<State>, state_tx: &Sender<State>,
+3 -2
View File
@@ -344,8 +344,8 @@ impl Editor {
} }
// builds the current file // builds the current file
if ui.button("Build").clicked() && !self.unsaved if ui.button("Build").clicked() && !self.unsaved {
&& let Some(path) = &self.path { if let Some(path) = &self.path {
let mut assembler = CompilerEngine::new(); let mut assembler = CompilerEngine::new();
if let Err(error) = assembler.assemble(path) { if let Err(error) = assembler.assemble(path) {
self.error = Some(format!("Failed to assemble: {error:?}")); self.error = Some(format!("Failed to assemble: {error:?}"));
@@ -371,6 +371,7 @@ impl Editor {
.flat_map(|i| i.encode().to_be_bytes().to_vec()) .flat_map(|i| i.encode().to_be_bytes().to_vec())
.collect(); .collect();
} }
}
// Loads the generated binary into the assembler at the provided offset // Loads the generated binary into the assembler at the provided offset
if ui.button("Load").clicked() { if ui.button("Load").clicked() {