fix(emqx_map_lib): fix static checks errors
This commit is contained in:
parent
8af7131a49
commit
b7a9f1e087
|
@ -174,12 +174,6 @@ covert_keys_to_atom(BinKeyMap, Conv) ->
|
||||||
|
|
||||||
%% copy from maps.erl OTP24.0
|
%% copy from maps.erl OTP24.0
|
||||||
-compile({inline, [error_with_info/2]}).
|
-compile({inline, [error_with_info/2]}).
|
||||||
-spec merge_with(Combiner, Map1, Map2) -> Map3 when
|
|
||||||
Map1 :: #{Key1 => Value1},
|
|
||||||
Map2 :: #{Key2 => Value2},
|
|
||||||
Combiner :: fun((Key1, Value1, Value2) -> CombineResult),
|
|
||||||
Map3 :: #{Key1 => CombineResult, Key1 => Value1, Key2 => Value2}.
|
|
||||||
|
|
||||||
merge_with(Combiner, Map1, Map2) when is_map(Map1),
|
merge_with(Combiner, Map1, Map2) when is_map(Map1),
|
||||||
is_map(Map2),
|
is_map(Map2),
|
||||||
is_function(Combiner, 3) ->
|
is_function(Combiner, 3) ->
|
||||||
|
@ -217,11 +211,10 @@ error_type_merge_intersect(M1, M2, Combiner) when is_function(Combiner, 3) ->
|
||||||
error_type_merge_intersect(_M1, _M2, _Combiner) ->
|
error_type_merge_intersect(_M1, _M2, _Combiner) ->
|
||||||
badarg.
|
badarg.
|
||||||
|
|
||||||
error_with_info(Reason, Args) ->
|
error_with_info(_, _) ->
|
||||||
erlang:error(Reason, Args, [{error_info, #{module => erl_stdlib_errors}}]).
|
{error_info, #{module => erl_stdlib_errors}}.
|
||||||
|
|
||||||
error_type_two_maps(M1, M2) when is_map(M1) ->
|
error_type_two_maps(M1, M2) when is_map(M1) ->
|
||||||
{badmap, M2};
|
{badmap, M2};
|
||||||
error_type_two_maps(M1, _M2) ->
|
error_type_two_maps(M1, _M2) ->
|
||||||
{badmap, M1}.
|
{badmap, M1}.
|
||||||
|
|
||||||
|
|
|
@ -827,7 +827,7 @@ aggregate_metrics([HeadMetrics | AllMetrics]) ->
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Fun = fun (ElemMap, AccMap) ->
|
Fun = fun (ElemMap, AccMap) ->
|
||||||
emqx_map_lib:merge_with(CombinerFun(CombinerFun), ElemMap, AccMap) end,
|
emqx_map_lib:merge_with(CombinerFun, ElemMap, AccMap) end,
|
||||||
lists:foldl(Fun, HeadMetrics, AllMetrics).
|
lists:foldl(Fun, HeadMetrics, AllMetrics).
|
||||||
|
|
||||||
make_result_map(ResList) ->
|
make_result_map(ResList) ->
|
||||||
|
@ -863,8 +863,6 @@ restructure_map(#{counters := #{failed := Failed, matched := Match, success := S
|
||||||
restructure_map(Error) ->
|
restructure_map(Error) ->
|
||||||
Error.
|
Error.
|
||||||
|
|
||||||
error_msg(Code, Msg) when is_binary(Msg) ->
|
|
||||||
#{code => Code, message => Msg};
|
|
||||||
error_msg(Code, Msg) ->
|
error_msg(Code, Msg) ->
|
||||||
#{code => Code, message => bin(io_lib:format("~p", [Msg]))}.
|
#{code => Code, message => bin(io_lib:format("~p", [Msg]))}.
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,7 @@
|
||||||
introduced_in() ->
|
introduced_in() ->
|
||||||
"5.0.0".
|
"5.0.0".
|
||||||
|
|
||||||
-type key() :: atom() | binary() | [byte()].
|
-spec lookup_from_all_nodes([node()], atom(), binary()) ->
|
||||||
|
|
||||||
-spec lookup_from_all_nodes([node()], key(), key()) ->
|
|
||||||
emqx_rpc:erpc_multicall().
|
emqx_rpc:erpc_multicall().
|
||||||
lookup_from_all_nodes(Nodes, ChainName, AuthenticatorID) ->
|
lookup_from_all_nodes(Nodes, ChainName, AuthenticatorID) ->
|
||||||
erpc:multicall(Nodes, emqx_authn_api, lookup_from_local_node, [ChainName, AuthenticatorID], ?TIMEOUT).
|
erpc:multicall(Nodes, emqx_authn_api, lookup_from_local_node, [ChainName, AuthenticatorID], ?TIMEOUT).
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ test_authenticator(PathPrefix) ->
|
||||||
ValidConfig0),
|
ValidConfig0),
|
||||||
{ok, 200, Res} = request(
|
{ok, 200, Res} = request(
|
||||||
get,
|
get,
|
||||||
uri(PathPrefix ++ [?CONF_NS, "password-based:http"])),
|
uri(PathPrefix ++ [?CONF_NS, "password_based:http"])),
|
||||||
{ok, RList} = emqx_json:safe_decode(Res),
|
{ok, RList} = emqx_json:safe_decode(Res),
|
||||||
Snd = fun ({_, Val}) -> Val end,
|
Snd = fun ({_, Val}) -> Val end,
|
||||||
LookupVal = fun LookupV(List, RestJson) ->
|
LookupVal = fun LookupV(List, RestJson) ->
|
||||||
|
|
Loading…
Reference in New Issue