Fix some warnings

This commit is contained in:
Sofia 2025-07-22 23:25:49 +03:00
parent 9df1593de9
commit 97f5eebf22
7 changed files with 14 additions and 30 deletions

View File

@ -131,7 +131,7 @@ impl InstructionHolder {
fn builder_fmt(
&self,
f: &mut impl std::fmt::Write,
builder: &Builder,
_builder: &Builder,
debug: &Option<DebugInformation>,
) -> 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<DebugInformation>,
_builder: &Builder,
_debug: &Option<DebugInformation>,
) -> std::fmt::Result {
match self {
TerminatorKind::Ret(instr) => writeln!(f, "ret {:?}", instr),

View File

@ -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;

View File

@ -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<FullToken>,
debug_types: Option<HashMap<TypeKind, DebugTypeValue>>,
type_values: HashMap<CustomTypeKey, TypeValue>,
}
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 }
}
}

View File

@ -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'];

View File

@ -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 {

View File

@ -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<CustomTypeKey>) {
fn import_type(_: &String, ty: &TypeKind) -> (TypeKind, Vec<CustomTypeKey>) {
let mut imported_types = Vec::new();
let ty = match &ty {
TypeKind::CustomType(key) => {

View File

@ -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},