From 236989defc7da2d3ec0ea0fb62baa4495a90802d Mon Sep 17 00:00:00 2001 From: ychenfo Date: Fri, 27 Aug 2021 16:38:42 +0800 Subject: [PATCH] nac3core: remove unnecessary inline and function parameters --- nac3core/src/toplevel/mod.rs | 7 +++---- nac3core/src/toplevel/type_annotation.rs | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/nac3core/src/toplevel/mod.rs b/nac3core/src/toplevel/mod.rs index 4be69600..b22a7817 100644 --- a/nac3core/src/toplevel/mod.rs +++ b/nac3core/src/toplevel/mod.rs @@ -491,8 +491,7 @@ impl TopLevelComposer { // push self to the ancestors class_ancestors.push(make_self_type_annotation( &temp_def_list, - class_id, - self.unifier.borrow_mut(), + class_id )?) } Ok(()) @@ -867,7 +866,7 @@ impl TopLevelComposer { }; type_var_to_concrete_def.insert( dummy_func_arg.ty, - make_self_type_annotation(temp_def_list, *class_id, unifier)?, + make_self_type_annotation(temp_def_list, *class_id)?, ); result.push(dummy_func_arg); } @@ -926,7 +925,7 @@ impl TopLevelComposer { let dummy_return_type = unifier.get_fresh_var().0; type_var_to_concrete_def.insert( dummy_return_type, - make_self_type_annotation(temp_def_list, *class_id, unifier)?, + make_self_type_annotation(temp_def_list, *class_id)?, ); dummy_return_type } diff --git a/nac3core/src/toplevel/type_annotation.rs b/nac3core/src/toplevel/type_annotation.rs index f405258c..bd1a2fe6 100644 --- a/nac3core/src/toplevel/type_annotation.rs +++ b/nac3core/src/toplevel/type_annotation.rs @@ -222,7 +222,6 @@ pub fn get_type_from_type_annotation_kinds( /// the first return is the duplicated type \ /// the second return is the var_id of the duplicated type \ /// the third return is the var_id of the original type -#[inline] pub fn duplicate_type_var(unifier: &mut Unifier, type_var: Type) -> (Type, u32, u32) { let ty = unifier.get_ty(type_var); if let TypeEnum::TVar { id, range, .. } = ty.as_ref() { @@ -255,8 +254,7 @@ pub fn duplicate_type_var(unifier: &mut Unifier, type_var: Type) -> (Type, u32, /// and unify them with the class generic `T`, `V` pub fn make_self_type_annotation( top_level_defs: &[Arc>], - def_id: DefinitionId, - _unifier: &mut Unifier, + def_id: DefinitionId ) -> Result { let obj_def = top_level_defs.get(def_id.0).ok_or_else(|| "invalid definition id".to_string())?;