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