Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit d1055d3

Browse files
committed
Merge branch 'fix-dialyzer-errors-part2' into v3.7.x
2 parents 9b8a9a0 + 0fd64d7 commit d1055d3

File tree

6 files changed

+36
-31
lines changed

6 files changed

+36
-31
lines changed

mk/rabbitmq-build.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ endif
2929

3030
TEST_ERLC_OPTS += +nowarn_export_all
3131

32+
ifneq ($(PROJECT),rabbit_common)
3233
# Add the CLI ebin directory to the code path for the compiler: plugin
3334
# CLI extensions may access behaviour modules defined in this directory.
3435
RMQ_ERLC_OPTS += -pa $(DEPS_DIR)/rabbitmq_cli/_build/dev/lib/rabbitmqctl/ebin
36+
endif
3537

3638
# Add Lager parse_transform module and our default Lager extra sinks.
3739
LAGER_EXTRA_SINKS += rabbit_log \

src/lager_forwarder_backend.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
-record(state, {
2525
next_sink :: atom(),
26-
level :: {'mask', integer()}
26+
level :: {'mask', integer()} | inherit
2727
}).
2828

2929
%% @private

src/rabbit_control_misc.erl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,19 @@ step_with_exit_handler(AggregatorPid, Ref, Fun, Item) ->
9191
%% processes. await_emitters_termination/1 helper can be used as a
9292
%% last statement of remote function to ensure this behaviour.
9393
spawn_emitter_caller(Node, Mod, Fun, Args, Ref, Pid, Timeout) ->
94-
spawn_monitor(
95-
fun () ->
96-
case rpc_call_emitter(Node, Mod, Fun, Args, Ref, Pid, Timeout) of
97-
{error, _} = Error ->
98-
Pid ! {Ref, error, Error};
99-
{bad_argument, _} = Error ->
100-
Pid ! {Ref, error, Error};
101-
{badrpc, _} = Error ->
102-
Pid ! {Ref, error, Error};
103-
_ ->
104-
ok
105-
end
106-
end),
94+
_ = spawn_monitor(
95+
fun () ->
96+
case rpc_call_emitter(Node, Mod, Fun, Args, Ref, Pid, Timeout) of
97+
{error, _} = Error ->
98+
Pid ! {Ref, error, Error};
99+
{bad_argument, _} = Error ->
100+
Pid ! {Ref, error, Error};
101+
{badrpc, _} = Error ->
102+
Pid ! {Ref, error, Error};
103+
_ ->
104+
ok
105+
end
106+
end),
107107
ok.
108108

109109
rpc_call_emitter(Node, Mod, Fun, Args, Ref, Pid, Timeout) ->
@@ -143,7 +143,7 @@ collect_monitors([Monitor|Rest]) ->
143143
%% number of live nodes, but it's not mandatory - thus more generic
144144
%% name of 'ChunkCount' was chosen.
145145
wait_for_info_messages(Pid, Ref, Fun, Acc0, Timeout, ChunkCount) ->
146-
notify_if_timeout(Pid, Ref, Timeout),
146+
_ = notify_if_timeout(Pid, Ref, Timeout),
147147
wait_for_info_messages(Ref, Fun, Acc0, ChunkCount).
148148

149149
wait_for_info_messages(Ref, Fun, Acc0, ChunksLeft) ->

src/rabbit_core_metrics.erl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,43 +150,43 @@ channel_stats(reductions, Id, Value) ->
150150

151151
channel_stats(exchange_stats, publish, Id, Value) ->
152152
%% Includes delete marker
153-
ets:update_counter(channel_exchange_metrics, Id, {2, Value}, {Id, 0, 0, 0, 0}),
153+
_ = ets:update_counter(channel_exchange_metrics, Id, {2, Value}, {Id, 0, 0, 0, 0}),
154154
ok;
155155
channel_stats(exchange_stats, confirm, Id, Value) ->
156156
%% Includes delete marker
157-
ets:update_counter(channel_exchange_metrics, Id, {3, Value}, {Id, 0, 0, 0, 0}),
157+
_ = ets:update_counter(channel_exchange_metrics, Id, {3, Value}, {Id, 0, 0, 0, 0}),
158158
ok;
159159
channel_stats(exchange_stats, return_unroutable, Id, Value) ->
160160
%% Includes delete marker
161-
ets:update_counter(channel_exchange_metrics, Id, {4, Value}, {Id, 0, 0, 0, 0}),
161+
_ = ets:update_counter(channel_exchange_metrics, Id, {4, Value}, {Id, 0, 0, 0, 0}),
162162
ok;
163163
channel_stats(queue_exchange_stats, publish, Id, Value) ->
164164
%% Includes delete marker
165-
ets:update_counter(channel_queue_exchange_metrics, Id, Value, {Id, 0, 0}),
165+
_ = ets:update_counter(channel_queue_exchange_metrics, Id, Value, {Id, 0, 0}),
166166
ok;
167167
channel_stats(queue_stats, get, Id, Value) ->
168168
%% Includes delete marker
169-
ets:update_counter(channel_queue_metrics, Id, {2, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
169+
_ = ets:update_counter(channel_queue_metrics, Id, {2, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
170170
ok;
171171
channel_stats(queue_stats, get_no_ack, Id, Value) ->
172172
%% Includes delete marker
173-
ets:update_counter(channel_queue_metrics, Id, {3, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
173+
_ = ets:update_counter(channel_queue_metrics, Id, {3, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
174174
ok;
175175
channel_stats(queue_stats, deliver, Id, Value) ->
176176
%% Includes delete marker
177-
ets:update_counter(channel_queue_metrics, Id, {4, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
177+
_ = ets:update_counter(channel_queue_metrics, Id, {4, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
178178
ok;
179179
channel_stats(queue_stats, deliver_no_ack, Id, Value) ->
180180
%% Includes delete marker
181-
ets:update_counter(channel_queue_metrics, Id, {5, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
181+
_ = ets:update_counter(channel_queue_metrics, Id, {5, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
182182
ok;
183183
channel_stats(queue_stats, redeliver, Id, Value) ->
184184
%% Includes delete marker
185-
ets:update_counter(channel_queue_metrics, Id, {6, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
185+
_ = ets:update_counter(channel_queue_metrics, Id, {6, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
186186
ok;
187187
channel_stats(queue_stats, ack, Id, Value) ->
188188
%% Includes delete marker
189-
ets:update_counter(channel_queue_metrics, Id, {7, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
189+
_ = ets:update_counter(channel_queue_metrics, Id, {7, Value}, {Id, 0, 0, 0, 0, 0, 0, 0}),
190190
ok.
191191

192192
delete(Table, Key) ->

src/rabbit_net.erl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
{raw, non_neg_integer(), non_neg_integer(), binary()}].
4141
-type hostname() :: inet:hostname().
4242
-type ip_port() :: inet:port_number().
43-
-type host_or_ip() :: binary() | inet:ip_address().
43+
% -type host_or_ip() :: binary() | inet:ip_address().
4444
-spec is_ssl(socket()) -> boolean().
4545
-spec ssl_info(socket()) -> 'nossl' | ok_val_or_error([{atom(), any()}]).
4646
-spec controlling_process(socket(), pid()) -> ok_or_any_error().
@@ -75,11 +75,14 @@
7575
'nossl' | ok_val_or_error(rabbit_ssl:certificate()).
7676
-spec connection_string(socket(), 'inbound' | 'outbound') ->
7777
ok_val_or_error(string()).
78-
-spec socket_ends(socket(), 'inbound' | 'outbound') ->
79-
ok_val_or_error({host_or_ip(), ip_port(),
80-
host_or_ip(), ip_port()}).
78+
% -spec socket_ends(socket() | ranch_proxy:proxy_socket() | ranch_proxy_ssl:ssl_socket(),
79+
% 'inbound' | 'outbound') ->
80+
% ok_val_or_error({host_or_ip(), ip_port(),
81+
% host_or_ip(), ip_port()}).
8182
-spec is_loopback(socket() | inet:ip_address()) -> boolean().
82-
-spec unwrap_socket(socket() | ranch_proxy:proxy_socket() | ranch_proxy_ssl:ssl_socket()) -> socket().
83+
% -spec unwrap_socket(socket() | ranch_proxy:proxy_socket() | ranch_proxy_ssl:ssl_socket()) -> socket().
84+
85+
-dialyzer({nowarn_function, [socket_ends/2, unwrap_socket/1]}).
8386

8487
%%---------------------------------------------------------------------------
8588

src/rabbit_nodes_common.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ names(Hostname) ->
4545
Ref = make_ref(),
4646
{Pid, MRef} = spawn_monitor(
4747
fun () -> Self ! {Ref, net_adm:names(Hostname)} end),
48-
timer:exit_after(?EPMD_TIMEOUT, Pid, timeout),
48+
_ = timer:exit_after(?EPMD_TIMEOUT, Pid, timeout),
4949
receive
5050
{Ref, Names} -> erlang:demonitor(MRef, [flush]),
5151
Names;

0 commit comments

Comments
 (0)