misc: get rid of some errors from Cargo lol

This commit is contained in:
2025-06-24 21:55:11 +01:00
parent 2a6991fe4a
commit 92c4660a4d
9 changed files with 119 additions and 107 deletions
+4 -6
View File
@@ -113,11 +113,10 @@ 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];
}
@@ -125,11 +124,10 @@ 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];
}
+3
View File
@@ -23,3 +23,6 @@ pub mod prelude {
pub use crate::tooling::brainf;
pub use crate::tooling::project;
}
use num_cpus as _;
use threadpool as _;
+7 -3
View File
@@ -1,3 +1,7 @@
use common as _;
use num_cpus as _;
use threadpool as _;
use assembler::{
prelude::*,
tooling::{brainf, project},
@@ -19,7 +23,7 @@ fn main() {
let mut file = match fs::File::create("brainf.dsb") {
Err(e) => {
eprintln!("Failed to create output file: {}", e);
eprintln!("Failed to create output file: {e}");
std::process::exit(1);
}
Ok(file) => file,
@@ -27,7 +31,7 @@ fn main() {
for instruction in result {
if let Err(e) = file.write(&instruction.encode().to_be_bytes()) {
eprintln!("Failed to write to output file: {}", e);
eprintln!("Failed to write to output file: {e}");
std::process::exit(1);
}
}
@@ -53,7 +57,7 @@ fn main() {
for instruction in result {
if let Err(e) = fs::write(output_path, instruction.encode().to_be_bytes()) {
eprintln!("Failed to write to output file: {}", e);
eprintln!("Failed to write to output file: {e}");
std::process::exit(1);
}
}