From 2c6499a0e2d903887ffc6d126ff4702eb82dfd7d Mon Sep 17 00:00:00 2001 From: Julian Hartl Date: Sun, 7 Jul 2024 16:53:42 +0200 Subject: [PATCH] Run cargo fix --- ir/crates/back/src/codegen/machine/function/mod.rs | 1 - .../src/codegen/register_allocator/linear_scan.rs | 1 - ir/crates/compiler/src/main.rs | 5 +---- ir/crates/middle/src/instruction.rs | 9 +++------ ir/crates/middle/src/module.rs | 1 - .../optimization/basic_block_pass/constant_fold.rs | 2 -- .../middle/src/optimization/basic_block_pass/cse.rs | 1 - .../function_pass/cfg_simplify/bb_merge.rs | 1 - .../function_pass/cfg_simplify/jump_threading.rs | 2 -- .../optimization/function_pass/cfg_simplify/mod.rs | 1 - .../cfg_simplify/unreachable_bb_elim.rs | 3 --- .../function_pass/constant_propagation.rs | 8 +------- lang/src/codegen/c/program.rs | 1 - lang/src/codegen/c/transpiler.rs | 2 +- lang/src/compilation_unit.rs | 3 --- lang/src/mir/builder.rs | 12 +++--------- .../mir/optimizations/global/branch_elimination.rs | 5 +---- 17 files changed, 10 insertions(+), 48 deletions(-) diff --git a/ir/crates/back/src/codegen/machine/function/mod.rs b/ir/crates/back/src/codegen/machine/function/mod.rs index 87b8811..6594afa 100644 --- a/ir/crates/back/src/codegen/machine/function/mod.rs +++ b/ir/crates/back/src/codegen/machine/function/mod.rs @@ -37,7 +37,6 @@ use crate::codegen::machine::{ Instr, InstrId, MachInstr, - Register, Size, TargetMachine, VRegRef, diff --git a/ir/crates/back/src/codegen/register_allocator/linear_scan.rs b/ir/crates/back/src/codegen/register_allocator/linear_scan.rs index 5eef4de..7937d58 100644 --- a/ir/crates/back/src/codegen/register_allocator/linear_scan.rs +++ b/ir/crates/back/src/codegen/register_allocator/linear_scan.rs @@ -9,7 +9,6 @@ use crate::codegen::{ VRegRef, }, register_allocator::{ - LiveRange, LivenessRepr, ProgPoint, RegAllocAlgorithm, diff --git a/ir/crates/compiler/src/main.rs b/ir/crates/compiler/src/main.rs index b66a7f2..0f1e959 100644 --- a/ir/crates/compiler/src/main.rs +++ b/ir/crates/compiler/src/main.rs @@ -3,10 +3,7 @@ use std::path::PathBuf; use anyhow::Result; use clap::Parser; use natrix_back::{ - codegen::{ - register_allocator, - targets::x86_64, - }, + codegen::targets::x86_64, emu::Emulator, }; use natrix_middle::{ diff --git a/ir/crates/middle/src/instruction.rs b/ir/crates/middle/src/instruction.rs index 3d81cf6..7053293 100644 --- a/ir/crates/middle/src/instruction.rs +++ b/ir/crates/middle/src/instruction.rs @@ -1,9 +1,6 @@ -use std::{ - fmt::{ - Display, - Formatter, - }, - ops::Sub, +use std::fmt::{ + Display, + Formatter, }; use smallvec::{ diff --git a/ir/crates/middle/src/module.rs b/ir/crates/middle/src/module.rs index 543668f..49b5a40 100644 --- a/ir/crates/middle/src/module.rs +++ b/ir/crates/middle/src/module.rs @@ -17,7 +17,6 @@ use crate::{ optimization::PipelineConfig, Function, FunctionRef, - Instr, }; #[derive(Debug, Clone, Default)] diff --git a/ir/crates/middle/src/optimization/basic_block_pass/constant_fold.rs b/ir/crates/middle/src/optimization/basic_block_pass/constant_fold.rs index dd2b60f..cfd1027 100644 --- a/ir/crates/middle/src/optimization/basic_block_pass/constant_fold.rs +++ b/ir/crates/middle/src/optimization/basic_block_pass/constant_fold.rs @@ -1,5 +1,4 @@ use rustc_hash::FxHashMap; -use tracing::debug; use crate::{ cfg::{ @@ -200,7 +199,6 @@ impl ConstantFoldPass { #[cfg(test)] mod tests { use crate::{ - cfg, optimization::PipelineConfig, test::{ assert_module_is_equal_to_src, diff --git a/ir/crates/middle/src/optimization/basic_block_pass/cse.rs b/ir/crates/middle/src/optimization/basic_block_pass/cse.rs index 656de9b..4d70635 100644 --- a/ir/crates/middle/src/optimization/basic_block_pass/cse.rs +++ b/ir/crates/middle/src/optimization/basic_block_pass/cse.rs @@ -62,7 +62,6 @@ impl BasicBlockPass for CSEPass { #[cfg(test)] mod tests { use crate::{ - cfg, optimization::PipelineConfig, test::create_test_module_from_source, }; diff --git a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/bb_merge.rs b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/bb_merge.rs index f6e66a3..52be523 100644 --- a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/bb_merge.rs +++ b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/bb_merge.rs @@ -115,7 +115,6 @@ impl FunctionPass for Pass { #[cfg(test)] mod tests { use crate::{ - cfg, optimization::{ CFGSimplifyPipelineConfig, PipelineConfig, diff --git a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/jump_threading.rs b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/jump_threading.rs index feb3d27..124e348 100644 --- a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/jump_threading.rs +++ b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/jump_threading.rs @@ -1,5 +1,3 @@ -use tracing::debug; - use crate::{ cfg::{ BasicBlockRef, diff --git a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/mod.rs b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/mod.rs index 60e5360..8202e46 100644 --- a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/mod.rs +++ b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/mod.rs @@ -57,7 +57,6 @@ mod tests { use tracing_test::traced_test; use crate::{ - cfg, optimization::{ CFGSimplifyPipelineConfig, PipelineConfig, diff --git a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/unreachable_bb_elim.rs b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/unreachable_bb_elim.rs index bb248e0..5d5be3a 100644 --- a/ir/crates/middle/src/optimization/function_pass/cfg_simplify/unreachable_bb_elim.rs +++ b/ir/crates/middle/src/optimization/function_pass/cfg_simplify/unreachable_bb_elim.rs @@ -12,7 +12,6 @@ use crate::{ module::Module, optimization::function_pass::FunctionPass, FunctionRef, - Instr, }; /// # Unreachable Basic Block Elimination @@ -153,10 +152,8 @@ mod tests { use tracing_test::traced_test; use crate::{ - cfg, optimization::{ CFGSimplifyPipelineConfig, - Pipeline, PipelineConfig, }, test::{ diff --git a/ir/crates/middle/src/optimization/function_pass/constant_propagation.rs b/ir/crates/middle/src/optimization/function_pass/constant_propagation.rs index 0a8a59e..953ce25 100644 --- a/ir/crates/middle/src/optimization/function_pass/constant_propagation.rs +++ b/ir/crates/middle/src/optimization/function_pass/constant_propagation.rs @@ -1,8 +1,3 @@ -use tracing::{ - debug, - debug_span, -}; - use crate::{ analysis::dataflow::{ concrete_value, @@ -12,7 +7,6 @@ use crate::{ }, cfg::TerminatorKind, instruction::{ - Const, InstrKind, Op, }, @@ -38,7 +32,7 @@ impl FunctionPass for ConstantPropagation { let mut changes = 0; let mut analysis_runner = concrete_value::AnalysisRunner::new(&mut module.functions[function]); - while let Some((bb_ref, mut instr_walker)) = analysis_runner.next_bb() { + while let Some((bb_ref, instr_walker)) = analysis_runner.next_bb() { // let bb = instr_walker.function.cfg.basic_block(bb_id); // let bb_args = bb.arguments(); // if !bb_args.is_empty() { diff --git a/lang/src/codegen/c/program.rs b/lang/src/codegen/c/program.rs index 853e580..b4538d2 100644 --- a/lang/src/codegen/c/program.rs +++ b/lang/src/codegen/c/program.rs @@ -12,7 +12,6 @@ use crate::{ CAst, CBlock, CExpr, - CFunctionDecl, CItem, CParameter, CStmt, diff --git a/lang/src/codegen/c/transpiler.rs b/lang/src/codegen/c/transpiler.rs index 4b22c91..b317709 100644 --- a/lang/src/codegen/c/transpiler.rs +++ b/lang/src/codegen/c/transpiler.rs @@ -121,7 +121,7 @@ impl<'a> CTranspiler<'a> { CItem::FunctionDecl(function_decl) => function_decl, _ => unreachable!(), }; - let mut body_stmts = function + let body_stmts = function .body .iter() .map(|stmt| self.transpile_stmt(ast, *stmt)) diff --git a/lang/src/compilation_unit.rs b/lang/src/compilation_unit.rs index 2ef5428..c5e975a 100644 --- a/lang/src/compilation_unit.rs +++ b/lang/src/compilation_unit.rs @@ -1,6 +1,5 @@ use std::{ cell::RefCell, - ops::Deref, rc::Rc, }; @@ -30,7 +29,6 @@ use crate::{ BoolExpr, CallExpr, Expr, - ExprId, FunctionDeclaration, IfExpr, ItemId, @@ -39,7 +37,6 @@ use crate::{ ParenthesizedExpr, ReturnStmt, Stmt, - StmtId, StmtKind, UnOpKind, UnaryExpr, diff --git a/lang/src/mir/builder.rs b/lang/src/mir/builder.rs index 296aab8..0946e2c 100644 --- a/lang/src/mir/builder.rs +++ b/lang/src/mir/builder.rs @@ -1,12 +1,6 @@ -use std::{ - collections::{ - HashMap, - HashSet, - }, - ops::{ - Deref, - DerefMut, - }, +use std::collections::{ + HashMap, + HashSet, }; use fusion_compiler::{ diff --git a/lang/src/mir/optimizations/global/branch_elimination.rs b/lang/src/mir/optimizations/global/branch_elimination.rs index 5d1cb69..26012d3 100644 --- a/lang/src/mir/optimizations/global/branch_elimination.rs +++ b/lang/src/mir/optimizations/global/branch_elimination.rs @@ -1,7 +1,4 @@ -use std::collections::{ - HashMap, - HashSet, -}; +use std::collections::HashMap; use itertools::Itertools;