Skip to content

Commit 61af236

Browse files
robertoaloimeta-codesync[bot]
authored andcommitted
Have the create_dynamic_call_patterns function take patterns as an input
Summary: Take the patterns as a (mutable) input. Reviewed By: alanz Differential Revision: D85553374 fbshipit-source-id: a3185c3d0ffabc5af042fe88324cec6f79860462
1 parent 41b9e1a commit 61af236

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crates/hir/src/sema/to_def.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,7 @@ macro_rules! add_patterns {
815815
};
816816
}
817817

818-
fn create_dynamic_call_patterns() -> FxHashMap<PatternKey, DynamicCallPattern> {
819-
let mut patterns = FxHashMap::default();
820-
818+
fn add_dynamic_call_patterns(patterns: &mut FxHashMap<PatternKey, DynamicCallPattern>) {
821819
// Each entry follows the format:
822820
//
823821
// (module, function, arity, module_arg_index, function_arg_index, args_list_index, direct_arity)
@@ -884,14 +882,15 @@ fn create_dynamic_call_patterns() -> FxHashMap<PatternKey, DynamicCallPattern> {
884882
(Some("erpc"), "send_request", 6, Some(1), 2, 3, false),
885883
]
886884
);
887-
888-
patterns
889885
}
890886

891887
// Lazy static initialization for the patterns map
892888
lazy_static! {
893-
static ref DYNAMIC_CALL_PATTERNS: FxHashMap<PatternKey, DynamicCallPattern> =
894-
create_dynamic_call_patterns();
889+
static ref DYNAMIC_CALL_PATTERNS: FxHashMap<PatternKey, DynamicCallPattern> = {
890+
let mut patterns = FxHashMap::default();
891+
add_dynamic_call_patterns(&mut patterns);
892+
patterns
893+
};
895894
}
896895

897896
fn get_dynamic_call_patterns() -> &'static FxHashMap<PatternKey, DynamicCallPattern> {

0 commit comments

Comments
 (0)