refactor: change style of case clause

This commit is contained in:
Thales Macedo Garitezi 2024-07-24 10:13:48 -03:00
parent 216a6abed9
commit 2d507146ab
1 changed files with 4 additions and 6 deletions

View File

@ -498,13 +498,11 @@ with_link(Name, FoundFn, NotFoundFn) ->
case emqx_cluster_link_config:link_raw(Name) of
undefined ->
NotFoundFn();
Link0 = #{} ->
Link0 = #{} when is_function(FoundFn, 1) ->
Link = fill_defaults_single(Link0),
{arity, Arity} = erlang:fun_info(FoundFn, arity),
case Arity of
1 -> FoundFn(Link);
0 -> FoundFn()
end
FoundFn(Link);
_Link = #{} when is_function(FoundFn, 0) ->
FoundFn()
end.
fill_defaults_single(Link0) ->