Skip to content

Commit d3a3ace

Browse files
Refactor: as_list/1 belongs to rabbit_data_coercion
1 parent 55411e6 commit d3a3ace

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

deps/rabbit_common/src/rabbit_data_coercion.erl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
-export([to_binary/1, to_list/1, to_atom/1, to_integer/1, to_proplist/1, to_map/1]).
1111
-export([to_atom/2, atomize_keys/1, to_list_of_binaries/1]).
1212
-export([to_utf8_binary/1, to_unicode_charlist/1]).
13+
-export([as_list/1]).
1314

1415
-spec to_binary(Val :: binary() | list() | atom() | integer() | function()) -> binary().
1516
to_binary(Val) when is_list(Val) -> list_to_binary(Val);
@@ -109,3 +110,9 @@ to_unicode_charlist(Val) ->
109110
UnicodeValue ->
110111
UnicodeValue
111112
end.
113+
114+
-spec as_list(list() | any()) -> [any()].
115+
as_list(Nodes) when is_list(Nodes) ->
116+
Nodes;
117+
as_list(Other) ->
118+
[Other].

deps/rabbitmq_peer_discovery_common/src/rabbit_peer_discovery_cleanup.erl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
-compile(export_all).
2929
-endif.
3030

31+
-import(rabbit_data_coercion, [as_list/1]).
32+
3133
-define(CONFIG_MODULE, rabbit_peer_discovery_config).
3234
-define(CONFIG_KEY, node_cleanup).
3335

@@ -318,9 +320,3 @@ service_discovery_nodes() ->
318320
#{domain => ?RMQLOG_DOMAIN_PEER_DIS}),
319321
[]
320322
end.
321-
322-
-spec as_list(list() | any()) -> [any()].
323-
as_list(Nodes) when is_list(Nodes) ->
324-
Nodes;
325-
as_list(Other) ->
326-
[Other].

0 commit comments

Comments
 (0)