From fd9f66b8d9655c0ca6b4bc6552a9a25a864c49a5 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 6 Dec 2023 11:03:46 +0800 Subject: [PATCH] meta: Remove redundant casts and brackets --- nac3artiq/src/symbol_resolver.rs | 2 +- nac3core/src/codegen/expr.rs | 2 +- nac3core/src/toplevel/composer.rs | 2 +- nac3ld/src/lib.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nac3artiq/src/symbol_resolver.rs b/nac3artiq/src/symbol_resolver.rs index 6fd3a7e3..03a10eee 100644 --- a/nac3artiq/src/symbol_resolver.rs +++ b/nac3artiq/src/symbol_resolver.rs @@ -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(), }); diff --git a/nac3core/src/codegen/expr.rs b/nac3core/src/codegen/expr.rs index 43185141..30aa2e3f 100644 --- a/nac3core/src/codegen/expr.rs +++ b/nac3core/src/codegen/expr.rs @@ -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) => { diff --git a/nac3core/src/toplevel/composer.rs b/nac3core/src/toplevel/composer.rs index e9e032eb..f1de1073 100644 --- a/nac3core/src/toplevel/composer.rs +++ b/nac3core/src/toplevel/composer.rs @@ -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) { diff --git a/nac3ld/src/lib.rs b/nac3ld/src/lib.rs index 53323fb9..e92ae74e 100644 --- a/nac3ld/src/lib.rs +++ b/nac3ld/src/lib.rs @@ -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,