misc: clippy lint fixes

This commit is contained in:
2025-06-23 18:23:01 +01:00
parent 083628ec7e
commit f432fe7665
5 changed files with 9 additions and 10 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ impl Default for Program {
} }
} }
struct ProgramRef { pub struct ProgramRef {
program: Arc<Mutex<Program>>, program: Arc<Mutex<Program>>,
} }
+1 -1
View File
@@ -13,7 +13,7 @@ pub fn codegen(nodes: Vec<Node>) -> Result<Vec<Instruction>, AssembleError> {
for node in nodes { for node in nodes {
instructions.push( instructions.push(
build_instruction(node.clone()) build_instruction(node.clone())
.expect(format!("Failed to build instruction: {:?}", node).as_str()), .unwrap_or_else(|_| panic!("Failed to build instruction: {:?}", node)),
); );
} }
+1
View File
@@ -20,6 +20,7 @@ fn log(message: &str) {
#[macro_use] #[macro_use]
pub mod macros; pub mod macros;
#[allow(clippy::module_inception)]
pub mod assembler; pub mod assembler;
pub mod codegen; pub mod codegen;
pub mod expand; pub mod expand;
+4 -7
View File
@@ -1,9 +1,6 @@
use std::{ use std::{fs, path::Path};
fs,
path::{self, Path},
};
use common::prelude::{Instruction, Register}; use common::prelude::*;
use crate::{ use crate::{
assembler::{ assembler::{
@@ -48,7 +45,7 @@ pub fn parse(src: String) -> Vec<Node> {
let tokens = lex(src); let tokens = lex(src);
let mut id = 0; let _id = 0;
let mut idstack = Vec::<u32>::new(); let mut idstack = Vec::<u32>::new();
nodes.extend(vec![ nodes.extend(vec![
@@ -290,7 +287,7 @@ fn lex(src: String) -> Vec<BfToken> {
.collect() .collect()
} }
fn create_symbol(id: u32) -> Symbol { fn _create_symbol(id: u32) -> Symbol {
Symbol { Symbol {
name: format!("label_{}", id), name: format!("label_{}", id),
module: Module::Resolved(0), module: Module::Resolved(0),
+2 -1
View File
@@ -1,3 +1,4 @@
use std::fmt::Write;
use std::{ use std::{
ffi::OsStr, ffi::OsStr,
fs, fs,
@@ -260,7 +261,7 @@ impl Editor {
Ok(content) => { Ok(content) => {
let mut res = String::new(); let mut res = String::new();
for (i, b) in content.iter().enumerate() { for (i, b) in content.iter().enumerate() {
res.push_str(&format!("{b:02x}")); _ = write!(res, "{b:02x}");
if i % 4 == 3 { if i % 4 == 3 {
res.push('\n'); res.push('\n');
} }