Fix some dialyzer warnings (#3988)

This commit is contained in:
Ayodele 2021-01-05 20:49:50 +01:00 committed by GitHub
parent ca1e78677e
commit 2b481dabe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 5 deletions

View File

@ -105,6 +105,8 @@ validate_params(Params) ->
{error, ?ERROR8, Msg}
end.
%% TODO who and reason is undefined - causing dialyzer errors. fix later
-dialyzer({nowarn_function,pack_banned/1}).
pack_banned(Params) ->
Now = erlang:system_time(second),
do_pack_banned(Params, #banned{by = <<"user">>,

View File

@ -145,6 +145,7 @@
-record(banned, {
who :: {clientid, binary()}
| {peerhost, inet:ip_address()}
| {username, binary()}
| {ip_address, inet:ip_address()},
by :: binary(),

View File

@ -184,7 +184,7 @@ hook(HookPoint, Action, InitArgs) when is_list(InitArgs) ->
hook(HookPoint, Action, Filter, Priority) ->
emqx_hooks:add(HookPoint, Action, Filter, Priority).
-spec(unhook(emqx_hooks:hookpoint(), fun() | {atom(), atom()} | {atom(), atom(), [any()]}) -> ok).
-spec(unhook(emqx_hooks:hookpoint(), emqx_hooks:action() | {module(), atom()}) -> ok).
unhook(HookPoint, Action) ->
emqx_hooks:del(HookPoint, Action).

View File

@ -121,7 +121,7 @@ put(HookPoint, Callback) ->
end.
%% @doc Unregister a callback.
-spec(del(hookpoint(), function() | {module(), atom()}) -> ok).
-spec(del(hookpoint(), action() | {module(), atom()}) -> ok).
del(HookPoint, Action) ->
gen_server:cast(?SERVER, {del, HookPoint, Action}).

View File

@ -127,7 +127,7 @@
expiry_interval => non_neg_integer(),
atom() => term()
}).
-type(clientinfo() :: #{zone := zone(),
-type(clientinfo() :: #{zone := maybe(zone()),
protocol := protocol(),
peerhost := peerhost(),
sockport := non_neg_integer(),