refactor: change style of case clause
This commit is contained in:
parent
216a6abed9
commit
2d507146ab
|
@ -498,13 +498,11 @@ with_link(Name, FoundFn, NotFoundFn) ->
|
||||||
case emqx_cluster_link_config:link_raw(Name) of
|
case emqx_cluster_link_config:link_raw(Name) of
|
||||||
undefined ->
|
undefined ->
|
||||||
NotFoundFn();
|
NotFoundFn();
|
||||||
Link0 = #{} ->
|
Link0 = #{} when is_function(FoundFn, 1) ->
|
||||||
Link = fill_defaults_single(Link0),
|
Link = fill_defaults_single(Link0),
|
||||||
{arity, Arity} = erlang:fun_info(FoundFn, arity),
|
FoundFn(Link);
|
||||||
case Arity of
|
_Link = #{} when is_function(FoundFn, 0) ->
|
||||||
1 -> FoundFn(Link);
|
FoundFn()
|
||||||
0 -> FoundFn()
|
|
||||||
end
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fill_defaults_single(Link0) ->
|
fill_defaults_single(Link0) ->
|
||||||
|
|
Loading…
Reference in New Issue