misc: clippy fixes
This commit is contained in:
Generated
+1
@@ -1064,6 +1064,7 @@ dependencies = [
|
||||
"rfd",
|
||||
"serde",
|
||||
"toml",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -108,11 +108,11 @@ impl Parser {
|
||||
let dest = expect_type!(self.next()?, Register)?;
|
||||
|
||||
let mut offset = Token::Immediate(0);
|
||||
if let Ok(next) = self.peek_next() {
|
||||
if expect_type!(next, Immediate).is_ok() {
|
||||
if let Ok(next) = self.peek_next()
|
||||
&& expect_type!(next, Immediate).is_ok()
|
||||
{
|
||||
offset = self.next()?;
|
||||
}
|
||||
}
|
||||
|
||||
args = vec![base, dest, offset];
|
||||
}
|
||||
@@ -120,11 +120,11 @@ impl Parser {
|
||||
let base = expect_type!(self.next()?, Register)?;
|
||||
let dest = expect_type!(self.next()?, Register, Symbol)?;
|
||||
let mut offset = Token::Immediate(0);
|
||||
if let Ok(next) = self.peek_next() {
|
||||
if expect_type!(next, Immediate).is_ok() {
|
||||
if let Ok(next) = self.peek_next()
|
||||
&& expect_type!(next, Immediate).is_ok()
|
||||
{
|
||||
offset = self.next()?;
|
||||
}
|
||||
}
|
||||
args = vec![base, dest, offset];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ fn main() {
|
||||
let mut output_file = match fs::File::create(output_path) {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to create output file: {}", e);
|
||||
eprintln!("Failed to create output file: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
@@ -33,7 +33,7 @@ fn main() {
|
||||
|
||||
// Assemble the source file
|
||||
if let Err(e) = engine.assemble(&src) {
|
||||
eprintln!("Assembly error: {}", e);
|
||||
eprintln!("Assembly error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ fn main() {
|
||||
for instruction in instructions {
|
||||
if let Err(e) = output_file.write_all(&instruction.encode().to_le_bytes())
|
||||
{
|
||||
eprintln!("Failed to write to output file: {}", e);
|
||||
eprintln!("Failed to write to output file: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(Err(e)) => {
|
||||
eprintln!("Build error: {}", e);
|
||||
eprintln!("Build error: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
None => {
|
||||
|
||||
@@ -20,7 +20,7 @@ pub fn tool_libcreate() {
|
||||
_ => panic!("Invalid project type"),
|
||||
};
|
||||
|
||||
let path = format!("{}/{}.dsa", project_path, project_name);
|
||||
let path = format!("{project_path}/{project_name}.dsa");
|
||||
std::fs::write(path, template).expect("Unable to write file");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ pub mod logging;
|
||||
use std::io::Write;
|
||||
|
||||
pub fn input(prompt: &str) -> String {
|
||||
print!("{}\n > ", prompt);
|
||||
print!("{prompt}\n > ");
|
||||
std::io::stdout().flush().unwrap();
|
||||
let mut input = String::new();
|
||||
std::io::stdin().read_line(&mut input).unwrap();
|
||||
|
||||
@@ -7,6 +7,7 @@ default-run = "emulator"
|
||||
[lib]
|
||||
name = "dsa_rs"
|
||||
path = "src/lib.rs"
|
||||
type = "cdylib"
|
||||
|
||||
[[bin]]
|
||||
name = "emulator"
|
||||
@@ -23,6 +24,7 @@ dirs = "6.0.0"
|
||||
discord-presence = { version = "1.6.0", optional = true }
|
||||
toml = { version = "0.8.23", optional = true }
|
||||
serde = { version = "1.0.219", features = ["derive"], optional = true }
|
||||
winit = { version = "0.30.11", features = ["android-native-activity"] }
|
||||
|
||||
[features]
|
||||
default = ["config"]
|
||||
|
||||
@@ -16,14 +16,7 @@
|
||||
//!
|
||||
//! Alternatively, you can hide this in your Discord settings.
|
||||
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::{
|
||||
Arc,
|
||||
mpsc::{Receiver, Sender},
|
||||
},
|
||||
time::Duration,
|
||||
};
|
||||
use std::sync::mpsc::{Receiver, Sender};
|
||||
|
||||
#[cfg(feature = "discord-rpc")]
|
||||
use discord_presence::{Client, DiscordError, models::ActivityTimestamps};
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::emulator::misc::rpc::{Activity, RpcClient};
|
||||
use crate::emulator::misc::rpc::RpcClient;
|
||||
use crate::emulator::system::{
|
||||
model::{Command, PersistentState, Running, State},
|
||||
processor::Processor,
|
||||
|
||||
@@ -344,8 +344,8 @@ impl Editor {
|
||||
}
|
||||
|
||||
// builds the current file
|
||||
if ui.button("Build").clicked() && !self.unsaved {
|
||||
if let Some(path) = &self.path {
|
||||
if ui.button("Build").clicked() && !self.unsaved
|
||||
&& let Some(path) = &self.path {
|
||||
let mut assembler = CompilerEngine::new();
|
||||
if let Err(error) = assembler.assemble(path) {
|
||||
self.error = Some(format!("Failed to assemble: {error:?}"));
|
||||
@@ -371,7 +371,6 @@ impl Editor {
|
||||
.flat_map(|i| i.encode().to_be_bytes().to_vec())
|
||||
.collect();
|
||||
}
|
||||
}
|
||||
|
||||
// Loads the generated binary into the assembler at the provided offset
|
||||
if ui.button("Load").clicked() {
|
||||
|
||||
Reference in New Issue
Block a user