diff --git a/reid-lsp/src/analysis.rs b/reid-lsp/src/analysis.rs index f6e2600..bff080f 100644 --- a/reid-lsp/src/analysis.rs +++ b/reid-lsp/src/analysis.rs @@ -1,8 +1,7 @@ -use std::{collections::HashMap, fmt::format, hash::Hash, path::PathBuf}; +use std::{collections::HashMap, hash::Hash, path::PathBuf}; use reid::{ ast::{ - self, FunctionDefinition, lexer::{FullToken, Token}, token_stream::TokenRange, }, diff --git a/reid/src/ast/mod.rs b/reid/src/ast/mod.rs index 0e84492..499c95f 100644 --- a/reid/src/ast/mod.rs +++ b/reid/src/ast/mod.rs @@ -1,7 +1,7 @@ //! This is the module that contains relevant code to parsing Reid, that is to //! say transforming a Vec of FullTokens into a loose parsed AST that can be //! used for unwrapping syntax sugar, and then be transformed into Reid MIR. -use std::{fs::Metadata, path::PathBuf}; +use std::path::PathBuf; use token_stream::TokenRange; diff --git a/reid/src/codegen/allocator.rs b/reid/src/codegen/allocator.rs index 174b29e..a9e9cc7 100644 --- a/reid/src/codegen/allocator.rs +++ b/reid/src/codegen/allocator.rs @@ -5,7 +5,7 @@ use reid_lib::{ Block, Instr, }; -use mir::{CustomTypeKey, FunctionCall, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement}; +use mir::{CustomTypeKey, FunctionDefinitionKind, IfExpression, TypeKind, WhileStatement}; use crate::mir::{self, FunctionParam, Metadata, SourceModuleId}; diff --git a/reid/src/codegen/mod.rs b/reid/src/codegen/mod.rs index f8df6b2..1158395 100644 --- a/reid/src/codegen/mod.rs +++ b/reid/src/codegen/mod.rs @@ -67,7 +67,7 @@ impl mir::Context { } for module in &modules_sorted { - let codegen = module.codegen(context, modules.clone())?; + module.codegen(context, modules.clone())?; } Ok(CodegenContext { context }) } @@ -75,7 +75,6 @@ impl mir::Context { #[derive(Clone)] struct ModuleCodegen<'ctx> { - name: String, module: Module<'ctx>, } @@ -596,10 +595,7 @@ impl mir::Module { } } - Ok(ModuleCodegen { - name: self.name.clone(), - module, - }) + Ok(ModuleCodegen { module }) } } diff --git a/reid/src/codegen/scope.rs b/reid/src/codegen/scope.rs index bc62913..fdca174 100644 --- a/reid/src/codegen/scope.rs +++ b/reid/src/codegen/scope.rs @@ -17,7 +17,7 @@ use crate::{ }, }; -use super::{allocator::Allocator, ErrorKind, IntrinsicFunction, ModuleCodegen}; +use super::{allocator::Allocator, ErrorKind, IntrinsicFunction}; pub struct Scope<'ctx, 'scope> { pub(super) context: &'ctx Context, diff --git a/reid/src/codegen/util.rs b/reid/src/codegen/util.rs index 95b61da..8e84e51 100644 --- a/reid/src/codegen/util.rs +++ b/reid/src/codegen/util.rs @@ -14,10 +14,7 @@ use crate::{ mir::{self, CustomTypeKey, Metadata, SourceModuleId, TypeDefinition, TypeDefinitionKind, TypeKind, VagueLiteral}, }; -use super::{ - scope::{Debug, Scope}, - ModuleCodegen, -}; +use super::scope::{Debug, Scope}; impl mir::CmpOperator { pub(super) fn predicate(&self) -> CmpPredicate { diff --git a/reid/src/mir/implement.rs b/reid/src/mir/implement.rs index 669930f..edccf07 100644 --- a/reid/src/mir/implement.rs +++ b/reid/src/mir/implement.rs @@ -1,5 +1,3 @@ -use reid_lib::builder::TypeValue; - use crate::util::maybe; use super::{typecheck::typerefs::TypeRefs, *}; diff --git a/reid/src/mir/linker.rs b/reid/src/mir/linker.rs index c717de0..0bf5dd2 100644 --- a/reid/src/mir/linker.rs +++ b/reid/src/mir/linker.rs @@ -1,9 +1,8 @@ use std::{ - cell::{RefCell, RefMut}, + cell::RefCell, collections::{HashMap, HashSet}, convert::Infallible, fs::{self}, - hash::Hash, path::PathBuf, rc::Rc, }; @@ -12,8 +11,8 @@ use crate::{ compile_module, error_raporting::{ErrorModules, ReidError}, mir::{ - pass::BinopKey, BinopDefinition, CustomTypeKey, FunctionDefinitionKind, FunctionParam, SourceModuleId, - StructType, TypeDefinition, TypeDefinitionKind, TypeKind, + pass::BinopKey, BinopDefinition, CustomTypeKey, FunctionDefinitionKind, SourceModuleId, StructType, + TypeDefinition, TypeDefinitionKind, TypeKind, }, parse_module, }; diff --git a/reid/src/mir/macros.rs b/reid/src/mir/macros.rs index 843cbf9..debab43 100644 --- a/reid/src/mir/macros.rs +++ b/reid/src/mir/macros.rs @@ -177,12 +177,7 @@ impl mir::Expression { globals.extend(expression.gen_macros(data, state, map)); globals.extend(expression1.gen_macros(data, state, map)); } - mir::ExprKind::AssociatedFunctionCall( - _, - FunctionCall { - parameters, is_macro, .. - }, - ) => { + mir::ExprKind::AssociatedFunctionCall(_, FunctionCall { parameters, .. }) => { for expression in parameters { globals.extend(expression.gen_macros(data, state, map)); } diff --git a/reid/src/mir/typecheck/typecheck.rs b/reid/src/mir/typecheck/typecheck.rs index f820808..aa3a8a8 100644 --- a/reid/src/mir/typecheck/typecheck.rs +++ b/reid/src/mir/typecheck/typecheck.rs @@ -84,7 +84,7 @@ impl<'t> Pass for TypeCheck<'t> { fn check_typedefs_for_recursion<'a, 'b>( defmap: &'b HashMap<&'a String, &'b TypeDefinition>, typedef: &'b TypeDefinition, - mut seen: HashSet, + seen: HashSet, state: &mut TypecheckPassState, ) { match &typedef.kind { @@ -194,7 +194,7 @@ impl FunctionDefinitionKind { block.typecheck(&mut state.inner(), &typerefs, hint.into()) } FunctionDefinitionKind::Extern(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))), - FunctionDefinitionKind::Intrinsic(intrinsic) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))), + FunctionDefinitionKind::Intrinsic(_) => Ok((ReturnKind::Soft, TypeKind::Vague(Vague::Unknown))), } } } @@ -771,7 +771,7 @@ impl Expression { Ok(function_call.return_type.clone().resolve_ref(typerefs)) } } - ExprKind::GlobalRef(global_value, type_kind) => Ok(self + ExprKind::GlobalRef(..) => Ok(self .return_type(typerefs, state.scope.module_id.unwrap()) .map(|r| r.1) .unwrap()), diff --git a/reid/src/mir/typecheck/typeinference.rs b/reid/src/mir/typecheck/typeinference.rs index 23567f4..3d07458 100644 --- a/reid/src/mir/typecheck/typeinference.rs +++ b/reid/src/mir/typecheck/typeinference.rs @@ -14,8 +14,8 @@ use crate::{ mir::{ implement::TypeCategory, pass::{AssociatedFunctionKey, ScopeVariable}, - BinopDefinition, Block, CustomTypeKey, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind, - IfExpression, Module, ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement, + BinopDefinition, Block, ExprKind, Expression, FunctionDefinition, FunctionDefinitionKind, IfExpression, Module, + ReturnKind, StmtKind, TypeKind, VagueType, WhileStatement, }, util::try_all, }; @@ -685,7 +685,7 @@ impl Expression { // Provide function return type Ok(type_refs.from_type(&fn_call.ret).unwrap()) } - ExprKind::GlobalRef(global_value, type_kind) => Ok(self + ExprKind::GlobalRef(..) => Ok(self .return_type(type_refs.types, state.scope.module_id.unwrap()) .map(|r| type_refs.from_type(&r.1).unwrap()) .unwrap()),