forked from M-Labs/nac3
1
0
Fork 0

meta: Remove redundant casts and brackets

This commit is contained in:
David Mak 2023-12-06 11:03:46 +08:00
parent 5182453bd9
commit fd9f66b8d9
4 changed files with 5 additions and 5 deletions

View File

@ -132,7 +132,7 @@ impl StaticValue for PythonValue {
PrimitiveValue::I32(val) => ctx.ctx.i32_type().const_int(*val as u64, false).into(),
PrimitiveValue::I64(val) => ctx.ctx.i64_type().const_int(*val as u64, false).into(),
PrimitiveValue::U32(val) => ctx.ctx.i32_type().const_int(*val as u64, false).into(),
PrimitiveValue::U64(val) => ctx.ctx.i64_type().const_int(*val as u64, false).into(),
PrimitiveValue::U64(val) => ctx.ctx.i64_type().const_int(*val, false).into(),
PrimitiveValue::F64(val) => ctx.ctx.f64_type().const_float(*val).into(),
PrimitiveValue::Bool(val) => ctx.ctx.i8_type().const_int(*val as u64, false).into(),
});

View File

@ -107,7 +107,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> {
SymbolValue::I32(v) => self.ctx.i32_type().const_int(*v as u64, true).into(),
SymbolValue::I64(v) => self.ctx.i64_type().const_int(*v as u64, true).into(),
SymbolValue::U32(v) => self.ctx.i32_type().const_int(*v as u64, false).into(),
SymbolValue::U64(v) => self.ctx.i64_type().const_int(*v as u64, false).into(),
SymbolValue::U64(v) => self.ctx.i64_type().const_int(*v, false).into(),
SymbolValue::Bool(v) => self.ctx.i8_type().const_int(*v as u64, true).into(),
SymbolValue::Double(v) => self.ctx.f64_type().const_float(*v).into(),
SymbolValue::Str(v) => {

View File

@ -758,7 +758,7 @@ impl TopLevelComposer {
let target_ty =
get_type_from_type_annotation_kinds(&temp_def_list, unifier, primitives, &def, &mut subst_list)?;
unifier.unify(ty, target_ty).map_err(|e| e.to_display(unifier).to_string())?;
Ok(()) as Result<(), String>
Ok(())
};
for (ty, def) in type_var_to_concrete_def {
if let Err(e) = unification_helper(ty, def) {

View File

@ -207,7 +207,7 @@ impl<'a> Linker<'a> {
STN_UNDEF => None,
sym_index => Some(
self.symtab
.get(sym_index as usize)
.get(sym_index)
.ok_or("symbol out of bounds of symbol table")?,
),
};
@ -1463,7 +1463,7 @@ impl<'a> Linker<'a> {
// Update the EHDR
let ehdr_ptr = linker.image.as_mut_ptr() as *mut Elf32_Ehdr;
unsafe {
(*ehdr_ptr) = Elf32_Ehdr {
*ehdr_ptr = Elf32_Ehdr {
e_ident: ehdr.e_ident,
e_type: ET_DYN,
e_machine: ehdr.e_machine,