Skip to content

Commit 0410b7e

Browse files
committed
Remove rabbit_queue_type:to_binary/1
As it is covered by rabbit_queue_type:short_alias_of/1
1 parent 73c6f96 commit 0410b7e

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

deps/rabbit/src/rabbit_amqp_management.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,13 @@ encode_queue(Q, NumMsgs, NumConsumers) ->
437437
{{utf8, <<"durable">>}, {boolean, Durable}},
438438
{{utf8, <<"auto_delete">>}, {boolean, AutoDelete}},
439439
{{utf8, <<"exclusive">>}, {boolean, Exclusive}},
440-
{{utf8, <<"type">>}, {utf8, rabbit_queue_type:to_binary(QType)}},
440+
{{utf8, <<"type">>},
441+
{utf8, case rabbit_queue_type:short_alias_of(QType) of
442+
undefined ->
443+
atom_to_binary(QType);
444+
ShortName ->
445+
ShortName
446+
end}},
441447
{{utf8, <<"arguments">>}, QArgs}
442448
],
443449
KVList1 = if is_list(Replicas) ->

deps/rabbit/src/rabbit_queue_type.erl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
close/1,
2121
discover/1,
2222
short_alias_of/1,
23-
to_binary/1,
2423
default/0,
2524
default_alias/0,
2625
fallback/0,
@@ -299,7 +298,7 @@ discover(Other) when is_binary(Other) ->
299298
{ok, Mod} = rabbit_registry:lookup_module(queue, T),
300299
Mod.
301300

302-
-spec short_alias_of(queue_type()) -> binary().
301+
-spec short_alias_of(queue_type()) -> undefined | binary().
303302
%% The opposite of discover/1: returns a short alias given a module name
304303
short_alias_of(<<"rabbit_quorum_queue">>) ->
305304
<<"quorum">>;
@@ -352,16 +351,6 @@ default() ->
352351
default_alias() ->
353352
short_alias_of(default()).
354353

355-
-spec to_binary(module()) -> binary().
356-
to_binary(rabbit_classic_queue) ->
357-
<<"classic">>;
358-
to_binary(rabbit_quorum_queue) ->
359-
<<"quorum">>;
360-
to_binary(rabbit_stream_queue) ->
361-
<<"stream">>;
362-
to_binary(Other) ->
363-
atom_to_binary(Other).
364-
365354
%% is a specific queue type implementation enabled
366355
-spec is_enabled(module()) -> boolean().
367356
is_enabled(Type) when is_atom(Type) ->

0 commit comments

Comments
 (0)