Fixes for various dialyzer warnings
This commit is contained in:
parent
57d7f7f8b5
commit
bef2756b5f
|
@ -38,11 +38,11 @@ try_decode(JSON, Opts) ->
|
|||
{error, Reason}
|
||||
end.
|
||||
|
||||
-spec encode(thoas:json_term()) -> iodata().
|
||||
-spec encode(thoas:input_term()) -> iodata().
|
||||
encode(Term) ->
|
||||
encode(Term, ?DEFAULT_ENCODE_OPTIONS).
|
||||
|
||||
-spec encode(thoas:json_term(), thoas:encode_options()) -> iodata().
|
||||
-spec encode(thoas:input_term(), thoas:encode_options()) -> iodata().
|
||||
encode(Term, Opts) ->
|
||||
%% Fixup for JSON encoding
|
||||
%% * Transforms any Funs into strings
|
||||
|
|
|
@ -27,7 +27,7 @@ init([]) ->
|
|||
|
||||
{ok, AuthCacheArgs} = application:get_env(rabbitmq_auth_backend_cache, cache_module_args),
|
||||
% Load module to be able to check exported function.
|
||||
code:load_file(AuthCache),
|
||||
_ = code:load_file(AuthCache),
|
||||
ChildSpecs = case erlang:function_exported(AuthCache, start_link,
|
||||
length(AuthCacheArgs)) of
|
||||
true -> [{auth_cache, {AuthCache, start_link, AuthCacheArgs},
|
||||
|
|
|
@ -9,25 +9,12 @@
|
|||
|
||||
-export([expiration/1, expired/1]).
|
||||
|
||||
-ifdef(use_specs).
|
||||
|
||||
-callback get(term()) -> term().
|
||||
|
||||
-callback put(term(), term(), integer()) -> ok.
|
||||
|
||||
-callback delete(term()) -> ok.
|
||||
|
||||
-else.
|
||||
|
||||
-export([behaviour_info/1]).
|
||||
|
||||
behaviour_info(callbacks) ->
|
||||
[{get, 1}, {put, 3}, {delete, 1}];
|
||||
behaviour_info(_Other) ->
|
||||
undefined.
|
||||
|
||||
-endif.
|
||||
|
||||
expiration(TTL) ->
|
||||
erlang:system_time(milli_seconds) + TTL.
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ do_delete(Key) ->
|
|||
erase({items, Key}),
|
||||
case erlang:get({timers, Key}) of
|
||||
undefined -> ok;
|
||||
Tref -> timer:cancel(Tref),
|
||||
Tref -> _ = timer:cancel(Tref),
|
||||
erase({timers, Key})
|
||||
|
||||
end.
|
||||
|
|
|
@ -73,7 +73,7 @@ terminate(_Reason, State = #state{}) ->
|
|||
do_delete(Key, Table, Timers) ->
|
||||
true = ets:delete(Table, Key),
|
||||
case ets:lookup(Timers, Key) of
|
||||
[{Key, Tref}] -> timer:cancel(Tref),
|
||||
[{Key, Tref}] -> _ = timer:cancel(Tref),
|
||||
true = ets:delete(Timers, Key);
|
||||
[] -> ok
|
||||
end.
|
||||
|
|
|
@ -39,8 +39,9 @@ put(Key, Value, TTL) ->
|
|||
ok.
|
||||
|
||||
delete(Key) ->
|
||||
[ets:delete(Table, Key)
|
||||
|| Table <- gen_server:call(?MODULE, get_segment_tables, ?CACHE_OPERATION_TIMEOUT)].
|
||||
_ = [ets:delete(Table, Key)
|
||||
|| Table <- gen_server:call(?MODULE, get_segment_tables, ?CACHE_OPERATION_TIMEOUT)],
|
||||
ok.
|
||||
|
||||
gc() ->
|
||||
case whereis(?MODULE) of
|
||||
|
@ -79,7 +80,7 @@ code_change(_OldVsn, State, _Extra) ->
|
|||
{ok, State}.
|
||||
|
||||
terminate(_Reason, State = #state{gc_timer = Timer}) ->
|
||||
timer:cancel(Timer),
|
||||
_ = timer:cancel(Timer),
|
||||
State.
|
||||
|
||||
partition_expired_segments(Segments) ->
|
||||
|
|
|
@ -43,8 +43,9 @@ put(Key, Value, TTL) ->
|
|||
ok.
|
||||
|
||||
delete(Key) ->
|
||||
[ets:delete(Table, Key)
|
||||
|| Table <- get_all_segment_tables()].
|
||||
_ = [ets:delete(Table, Key)
|
||||
|| Table <- get_all_segment_tables()],
|
||||
ok.
|
||||
|
||||
gc() ->
|
||||
case whereis(?MODULE) of
|
||||
|
@ -53,7 +54,7 @@ gc() ->
|
|||
end.
|
||||
|
||||
init([SegmentSize]) ->
|
||||
ets:new(?SEGMENT_TABLE, [ordered_set, named_table, public]),
|
||||
_ = ets:new(?SEGMENT_TABLE, [ordered_set, named_table, public]),
|
||||
ets:insert(?SEGMENT_TABLE, {segment_size, SegmentSize}),
|
||||
|
||||
InitSegment = segment(rabbit_auth_cache:expiration(SegmentSize), SegmentSize),
|
||||
|
@ -83,7 +84,7 @@ code_change(_OldVsn, State, _Extra) ->
|
|||
{ok, State}.
|
||||
|
||||
terminate(_Reason, State = #state{gc_timer = Timer}) ->
|
||||
timer:cancel(Timer),
|
||||
_ = timer:cancel(Timer),
|
||||
State.
|
||||
|
||||
segment(Expiration, SegmentSize) ->
|
||||
|
|
|
@ -167,10 +167,7 @@ do_http_req(Path0, Query) ->
|
|||
{ok, {{_HTTP, Code, _}, _Headers, Body}} ->
|
||||
rabbit_log:debug("auth_backend_http: response code is ~tp, body: ~tp", [Code, Body]),
|
||||
case lists:member(Code, ?SUCCESSFUL_RESPONSE_CODES) of
|
||||
true -> case parse_resp(Body) of
|
||||
{error, _} = E -> E;
|
||||
Resp -> Resp
|
||||
end;
|
||||
true -> parse_resp(Body);
|
||||
false -> {error, {Code, Body}}
|
||||
end;
|
||||
{error, _} = E ->
|
||||
|
|
|
@ -630,7 +630,7 @@ get_or_create_conn(IsAnon, Servers, Opts) ->
|
|||
{ok, Conn} ->
|
||||
Timeout = rabbit_misc:pget(idle_timeout, Opts, infinity),
|
||||
%% Defer the timeout by re-setting it.
|
||||
set_connection_timeout(Key, Timeout),
|
||||
_ = set_connection_timeout(Key, Timeout),
|
||||
{ok, {eldap_pooled, Conn}};
|
||||
error ->
|
||||
{Timeout, EldapOpts} = case lists:keytake(idle_timeout, 1, Opts) of
|
||||
|
@ -645,7 +645,7 @@ get_or_create_conn(IsAnon, Servers, Opts) ->
|
|||
%% Non-zero timeout, put it in the pool
|
||||
{{ok, Conn}, Timeout} ->
|
||||
put(ldap_conns, maps:put(Key, Conn, Conns)),
|
||||
set_connection_timeout(Key, Timeout),
|
||||
_ = set_connection_timeout(Key, Timeout),
|
||||
{ok, {eldap_pooled, Conn}};
|
||||
{Error, _} ->
|
||||
Error
|
||||
|
|
|
@ -36,7 +36,7 @@ start(_Type, _StartArgs) ->
|
|||
{ok, TLS} = application:get_env(rabbitmq_auth_backend_ldap, use_starttls),
|
||||
case SSL orelse TLS of
|
||||
true ->
|
||||
rabbit_networking:ensure_ssl(),
|
||||
_ = rabbit_networking:ensure_ssl(),
|
||||
ok;
|
||||
false -> ok
|
||||
end,
|
||||
|
|
|
@ -253,8 +253,8 @@ close_channels_and_connection(Config, Node) ->
|
|||
end.
|
||||
|
||||
publish(Ch, QName, Count) ->
|
||||
amqp_channel:call(Ch, #'confirm.select'{}),
|
||||
[amqp_channel:call(Ch,
|
||||
_ = amqp_channel:call(Ch, #'confirm.select'{}),
|
||||
_ = [amqp_channel:call(Ch,
|
||||
#'basic.publish'{routing_key = QName},
|
||||
#amqp_msg{props = #'P_basic'{delivery_mode = 2},
|
||||
payload = list_to_binary(integer_to_list(I))})
|
||||
|
@ -296,7 +296,7 @@ accumulate_without_acknowledging(Ch, CTag, Remaining, Acc) ->
|
|||
|
||||
|
||||
fetch(Ch, QName, Count) ->
|
||||
[{#'basic.get_ok'{}, _} =
|
||||
_ = [{#'basic.get_ok'{}, _} =
|
||||
amqp_channel:call(Ch, #'basic.get'{queue = QName}) ||
|
||||
_ <- lists:seq(1, Count)],
|
||||
ok.
|
||||
|
|
|
@ -38,12 +38,12 @@ info(_X) -> [].
|
|||
info(_X, _) -> [].
|
||||
|
||||
register() ->
|
||||
rabbit_exchange:declare(exchange(), topic, true, false, true, [],
|
||||
_ = rabbit_exchange:declare(exchange(), topic, true, false, true, [],
|
||||
?INTERNAL_USER),
|
||||
gen_event:add_handler(rabbit_event, ?MODULE, []).
|
||||
|
||||
unregister() ->
|
||||
rabbit_exchange:delete(exchange(), false, ?INTERNAL_USER),
|
||||
_ = rabbit_exchange:delete(exchange(), false, ?INTERNAL_USER),
|
||||
gen_event:delete_handler(rabbit_event, ?MODULE, []).
|
||||
|
||||
exchange() ->
|
||||
|
@ -73,7 +73,7 @@ handle_event(#event{type = Type,
|
|||
props = Props,
|
||||
timestamp = TS,
|
||||
reference = none}, #state{vhost = VHost} = State) ->
|
||||
case key(Type) of
|
||||
_ = case key(Type) of
|
||||
ignore -> ok;
|
||||
Key ->
|
||||
Props2 = [{<<"timestamp_in_ms">>, TS} | Props],
|
||||
|
|
|
@ -333,8 +333,8 @@ maybe_configure_proxy() ->
|
|||
"Configured HTTP proxy: ~tp, HTTPS proxy: ~tp, exclusions: ~tp",
|
||||
[HttpProxy, HttpsProxy, ProxyExclusions],
|
||||
#{domain => ?RMQLOG_DOMAIN_PEER_DIS}),
|
||||
maybe_set_proxy(proxy, HttpProxy, ProxyExclusions),
|
||||
maybe_set_proxy(https_proxy, HttpsProxy, ProxyExclusions),
|
||||
_ = maybe_set_proxy(proxy, HttpProxy, ProxyExclusions),
|
||||
_ = maybe_set_proxy(https_proxy, HttpsProxy, ProxyExclusions),
|
||||
ok
|
||||
end.
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ node_prefix() ->
|
|||
case getenv("RABBITMQ_NODENAME") of
|
||||
false -> ?DEFAULT_NODE_PREFIX;
|
||||
Value ->
|
||||
rabbit_data_coercion:to_list(getenv("RABBITMQ_NODENAME")),
|
||||
_ = rabbit_data_coercion:to_list(getenv("RABBITMQ_NODENAME")),
|
||||
lists:nth(1, string:tokens(Value, "@"))
|
||||
end.
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ handle_info(_I, State) ->
|
|||
|
||||
terminate(shutdown, State = #state{conn = Conn, ch = Ch,
|
||||
file = F, filename = Filename}) ->
|
||||
flush(State),
|
||||
_ = flush(State),
|
||||
catch amqp_channel:close(Ch),
|
||||
catch amqp_connection:close(Conn),
|
||||
catch prim_file:close(F),
|
||||
|
@ -196,7 +196,7 @@ log(text, Record, State) ->
|
|||
print_log(io_lib:format(Fmt, Args), State);
|
||||
|
||||
log(json, Record, State) ->
|
||||
print_log([rabbit_json:encode(
|
||||
_ = print_log([rabbit_json:encode(
|
||||
#{timestamp => Record#log_record.timestamp,
|
||||
type => Record#log_record.type,
|
||||
node => Record#log_record.node,
|
||||
|
@ -223,7 +223,7 @@ maybe_flush(State) ->
|
|||
State.
|
||||
|
||||
flush(State = #state{file = F, buf = Buf}) ->
|
||||
prim_file:write(F, lists:reverse(Buf)),
|
||||
_ = prim_file:write(F, lists:reverse(Buf)),
|
||||
State#state{buf = [], buf_cnt = 0}.
|
||||
|
||||
truncate(Payload, #state{max_payload = Max}) ->
|
||||
|
|
|
@ -29,8 +29,8 @@ start_child(Id, Args) ->
|
|||
[rabbit_tracing_consumer_sup]}).
|
||||
|
||||
stop_child(Id) ->
|
||||
supervisor:terminate_child(?SUPERVISOR, Id),
|
||||
supervisor:delete_child(?SUPERVISOR, Id),
|
||||
_ = supervisor:terminate_child(?SUPERVISOR, Id),
|
||||
_ = supervisor:delete_child(?SUPERVISOR, Id),
|
||||
ok.
|
||||
|
||||
%%----------------------------------------------------------------------------
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
refresh_interval :: integer()
|
||||
}).
|
||||
-record(entry, {
|
||||
name :: string(),
|
||||
name :: string() | undefined,
|
||||
cert_id :: term(),
|
||||
provider :: module(),
|
||||
issuer_id :: tuple(),
|
||||
|
@ -124,11 +124,11 @@ is_whitelisted(#'OTPCertificate'{}=C) ->
|
|||
|
||||
init([]) ->
|
||||
erlang:process_flag(trap_exit, true),
|
||||
ets:new(table_name(), table_options()),
|
||||
_ = ets:new(table_name(), table_options()),
|
||||
Config = application:get_all_env(rabbitmq_trust_store),
|
||||
ProvidersState = refresh_certs(Config, []),
|
||||
Interval = refresh_interval(Config),
|
||||
if
|
||||
_ = if
|
||||
Interval =:= 0 ->
|
||||
ok;
|
||||
Interval > 0 ->
|
||||
|
@ -275,13 +275,9 @@ load_and_decode_cert(Provider, CertId, Attributes, Config) ->
|
|||
try
|
||||
case Provider:load_cert(CertId, Attributes, Config) of
|
||||
{ok, Cert} ->
|
||||
case public_key:pkix_decode_cert(Cert, otp) of
|
||||
{error, Reason} ->
|
||||
{error, Reason};
|
||||
DecodedCert ->
|
||||
DecodedCert = public_key:pkix_decode_cert(Cert, otp),
|
||||
Id = extract_issuer_id(DecodedCert),
|
||||
{ok, Cert, Id}
|
||||
end;
|
||||
{ok, Cert, Id};
|
||||
{error, Reason} -> {error, Reason}
|
||||
end
|
||||
catch _:Error:Stacktrace ->
|
||||
|
|
|
@ -68,7 +68,7 @@ join_url(BaseUrl, CertPath) ->
|
|||
|
||||
init(Config) ->
|
||||
inets:start(httpc, [{profile, ?PROFILE}]),
|
||||
application:ensure_all_started(ssl),
|
||||
_ = application:ensure_all_started(ssl),
|
||||
Options = proplists:get_value(proxy_options, Config, []),
|
||||
httpc:set_options(Options, ?PROFILE).
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ websocket_info(Msg, State) ->
|
|||
terminate(_Reason, _Req, #state{proc_state = undefined}) ->
|
||||
ok;
|
||||
terminate(_Reason, _Req, #state{proc_state = ProcState}) ->
|
||||
rabbit_stomp_processor:flush_and_die(ProcState),
|
||||
_ = rabbit_stomp_processor:flush_and_die(ProcState),
|
||||
ok.
|
||||
|
||||
%%----------------------------------------------------------------------------
|
||||
|
@ -310,7 +310,7 @@ stop(State) ->
|
|||
stop(State = #state{proc_state = ProcState}, CloseCode, Error0) ->
|
||||
maybe_emit_stats(State),
|
||||
ok = file_handle_cache:release(),
|
||||
rabbit_stomp_processor:flush_and_die(ProcState),
|
||||
_ = rabbit_stomp_processor:flush_and_die(ProcState),
|
||||
Error1 = rabbit_data_coercion:to_binary(Error0),
|
||||
{[{close, CloseCode, Error1}], State}.
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ handle_event(_Event, State) ->
|
|||
{ok, State}.
|
||||
|
||||
handle_call(_Request, State) ->
|
||||
{ok, State}.
|
||||
{ok, undefined, State}.
|
||||
|
||||
handle_info(_Info, State) ->
|
||||
{ok, State}.
|
||||
|
|
|
@ -52,8 +52,8 @@ init() ->
|
|||
ok.
|
||||
|
||||
stop(State) ->
|
||||
rabbit_networking:stop_ranch_listener_of_protocol(?TCP_PROTOCOL),
|
||||
rabbit_networking:stop_ranch_listener_of_protocol(?TLS_PROTOCOL),
|
||||
_ = rabbit_networking:stop_ranch_listener_of_protocol(?TCP_PROTOCOL),
|
||||
_ = rabbit_networking:stop_ranch_listener_of_protocol(?TLS_PROTOCOL),
|
||||
State.
|
||||
|
||||
-spec list_connections() -> [pid()].
|
||||
|
@ -126,7 +126,7 @@ start_tcp_listener(TCPConf0, CowboyOpts0, Routes) ->
|
|||
|
||||
|
||||
start_tls_listener(TLSConf0, CowboyOpts0, Routes) ->
|
||||
rabbit_networking:ensure_ssl(),
|
||||
_ = rabbit_networking:ensure_ssl(),
|
||||
NumSslAcceptors = case application:get_env(rabbitmq_web_stomp, num_ssl_acceptors) of
|
||||
undefined -> get_env(num_acceptors, 10);
|
||||
{ok, NumSsl} -> NumSsl
|
||||
|
|
Loading…
Reference in New Issue