From 3038ded59e3dab7e03f0cea60a3ae96286bbb8af Mon Sep 17 00:00:00 2001 From: JianBo He Date: Wed, 10 Jan 2024 17:53:39 +0800 Subject: [PATCH] chore: make static_check happy --- .../src/emqx_coap_pubsub_handler.erl | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/apps/emqx_gateway_coap/src/emqx_coap_pubsub_handler.erl b/apps/emqx_gateway_coap/src/emqx_coap_pubsub_handler.erl index 65470d8b3..3127b756c 100644 --- a/apps/emqx_gateway_coap/src/emqx_coap_pubsub_handler.erl +++ b/apps/emqx_gateway_coap/src/emqx_coap_pubsub_handler.erl @@ -110,28 +110,24 @@ type_to_qos(coap, #coap_message{type = Type}) -> end. get_publish_opts(Msg) -> - case emqx_coap_message:extract_uri_query(Msg) of - undefined -> - #{}; - Qs -> - maps:fold( - fun - (<<"retain">>, V, Acc) -> - Val = V =:= <<"true">>, - Acc#{retain => Val}; - (<<"expiry">>, V, Acc) -> - Val = erlang:binary_to_integer(V), - Acc#{expiry_interval => Val}; - (<<"qos">>, V, Acc) -> - Val = erlang:binary_to_integer(V), - Acc#{qos => Val}; - (_, _, Acc) -> - Acc - end, - #{}, - Qs - ) - end. + Qs = emqx_coap_message:extract_uri_query(Msg), + maps:fold( + fun + (<<"retain">>, V, Acc) -> + Val = V =:= <<"true">>, + Acc#{retain => Val}; + (<<"expiry">>, V, Acc) -> + Val = erlang:binary_to_integer(V), + Acc#{expiry_interval => Val}; + (<<"qos">>, V, Acc) -> + Val = erlang:binary_to_integer(V), + Acc#{qos => Val}; + (_, _, Acc) -> + Acc + end, + #{}, + Qs + ). get_publish_qos(Msg, PublishOpts) -> case PublishOpts of