From 97f5eebf22aebdc0a2f29c351fd1a9a18ead75f4 Mon Sep 17 00:00:00 2001 From: sofia Date: Tue, 22 Jul 2025 23:25:49 +0300 Subject: [PATCH] Fix some warnings --- reid-llvm-lib/src/fmt.rs | 6 +++--- reid-llvm-lib/src/lib.rs | 2 -- reid/src/codegen.rs | 24 +++++++----------------- reid/src/lexer.rs | 2 +- reid/src/mir/fmt.rs | 5 +---- reid/src/mir/linker.rs | 4 ++-- reid/src/mir/typeinference.rs | 1 - 7 files changed, 14 insertions(+), 30 deletions(-) diff --git a/reid-llvm-lib/src/fmt.rs b/reid-llvm-lib/src/fmt.rs index 411bf9e..112b411 100644 --- a/reid-llvm-lib/src/fmt.rs +++ b/reid-llvm-lib/src/fmt.rs @@ -131,7 +131,7 @@ impl InstructionHolder { fn builder_fmt( &self, f: &mut impl std::fmt::Write, - builder: &Builder, + _builder: &Builder, debug: &Option, ) -> std::fmt::Result { if let Some(record) = &self.record { @@ -171,8 +171,8 @@ impl TerminatorKind { fn builder_fmt( &self, f: &mut impl std::fmt::Write, - builder: &Builder, - debug: &Option, + _builder: &Builder, + _debug: &Option, ) -> std::fmt::Result { match self { TerminatorKind::Ret(instr) => writeln!(f, "ret {:?}", instr), diff --git a/reid-llvm-lib/src/lib.rs b/reid-llvm-lib/src/lib.rs index c41268b..80e9ac5 100644 --- a/reid-llvm-lib/src/lib.rs +++ b/reid-llvm-lib/src/lib.rs @@ -7,10 +7,8 @@ use std::{fmt::Debug, marker::PhantomData}; use builder::{BlockValue, Builder, FunctionValue, InstructionValue, ModuleValue, TypeValue}; use debug_information::{ DebugFileData, DebugInformation, DebugLocationValue, DebugMetadataValue, DebugProgramValue, - InstructionDebugRecordData, }; use fmt::PrintableModule; -use util::match_types; pub mod builder; pub mod compile; diff --git a/reid/src/codegen.rs b/reid/src/codegen.rs index 671fa5d..21ad10e 100644 --- a/reid/src/codegen.rs +++ b/reid/src/codegen.rs @@ -1,12 +1,12 @@ -use std::{array, collections::HashMap, hash::Hash, mem}; +use std::{collections::HashMap, mem}; use reid_lib::{ - builder::{InstructionValue, ModuleValue, TypeValue}, + builder::{InstructionValue, TypeValue}, compile::CompiledModule, debug_information::{ DebugArrayType, DebugBasicType, DebugFieldType, DebugFileData, DebugInformation, - DebugLocalVariable, DebugLocation, DebugMetadata, DebugParamVariable, DebugPointerType, - DebugPosition, DebugProgramValue, DebugRecordKind, DebugStructType, DebugSubprogramData, + DebugLocalVariable, DebugLocation, DebugMetadata, DebugPointerType, DebugPosition, + DebugProgramValue, DebugRecordKind, DebugStructType, DebugSubprogramData, DebugSubprogramOptionals, DebugSubprogramType, DebugTypeData, DebugTypeValue, DwarfEncoding, DwarfFlags, InstructionDebugRecordData, }, @@ -15,12 +15,10 @@ use reid_lib::{ }; use crate::{ - error_raporting::ErrorModules, lexer::{FullToken, Position}, mir::{ - self, implement::TypeCategory, CustomTypeKey, Metadata, ModuleMap, NamedVariableRef, - SourceModuleId, StructField, StructType, TypeDefinition, TypeDefinitionKind, TypeKind, - VagueLiteral, + self, implement::TypeCategory, CustomTypeKey, Metadata, NamedVariableRef, SourceModuleId, + StructField, StructType, TypeDefinition, TypeDefinitionKind, TypeKind, VagueLiteral, }, }; @@ -57,9 +55,6 @@ impl mir::Context { #[derive(Clone)] struct ModuleCodegen<'ctx> { module: Module<'ctx>, - tokens: &'ctx Vec, - debug_types: Option>, - type_values: HashMap, } impl<'ctx> std::fmt::Debug for ModuleCodegen<'ctx> { @@ -456,12 +451,7 @@ impl mir::Module { } } - ModuleCodegen { - module, - debug_types: Some(debug_types), - type_values, - tokens: &self.tokens, - } + ModuleCodegen { module } } } diff --git a/reid/src/lexer.rs b/reid/src/lexer.rs index 79f0bbc..c3f16fe 100644 --- a/reid/src/lexer.rs +++ b/reid/src/lexer.rs @@ -1,4 +1,4 @@ -use std::{fmt::Debug, hint::unreachable_unchecked, str::Chars}; +use std::{fmt::Debug, str::Chars}; static DECIMAL_NUMERICS: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; diff --git a/reid/src/mir/fmt.rs b/reid/src/mir/fmt.rs index 89f2b95..f2c04cc 100644 --- a/reid/src/mir/fmt.rs +++ b/reid/src/mir/fmt.rs @@ -2,10 +2,7 @@ use std::fmt::{Debug, Display, Write}; use crate::pad_adapter::PadAdapter; -use super::{ - typerefs::{TypeRef, TypeRefs}, - *, -}; +use super::{typerefs::TypeRefs, *}; impl Display for TypeRefs { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/reid/src/mir/linker.rs b/reid/src/mir/linker.rs index 3e0889f..14e5e13 100644 --- a/reid/src/mir/linker.rs +++ b/reid/src/mir/linker.rs @@ -10,7 +10,7 @@ use std::{ use crate::{ compile_module, error_raporting::{ErrorModules, ReidError}, - mir::{SourceModuleId, TypeDefinition, CustomTypeKey, TypeKind}, + mir::{CustomTypeKey, SourceModuleId, TypeDefinition, TypeKind}, parse_module, }; @@ -232,7 +232,7 @@ impl<'map> Pass for LinkerPass<'map> { } } - fn import_type(base: &String, ty: &TypeKind) -> (TypeKind, Vec) { + fn import_type(_: &String, ty: &TypeKind) -> (TypeKind, Vec) { let mut imported_types = Vec::new(); let ty = match &ty { TypeKind::CustomType(key) => { diff --git a/reid/src/mir/typeinference.rs b/reid/src/mir/typeinference.rs index 049e5c9..35bf42f 100644 --- a/reid/src/mir/typeinference.rs +++ b/reid/src/mir/typeinference.rs @@ -9,7 +9,6 @@ use std::{convert::Infallible, iter}; use crate::{mir::TypeKind, util::try_all}; use super::{ - implement::pick_return, pass::{Pass, PassResult, PassState}, typecheck::ErrorKind, typerefs::{ScopeTypeRefs, TypeRef, TypeRefs},