From e71019a3f62240c794a274868c1acad5d92308f1 Mon Sep 17 00:00:00 2001 From: Alexandre Hamez Date: Thu, 31 Oct 2024 23:38:52 +0100 Subject: [PATCH] refactor: use Enum.flat_map/2 --- lib/protox/define_decoder.ex | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/protox/define_decoder.ex b/lib/protox/define_decoder.ex index f377cebd..0411653d 100644 --- a/lib/protox/define_decoder.ex +++ b/lib/protox/define_decoder.ex @@ -150,8 +150,7 @@ defmodule Protox.DefineDecoder do end defp make_parse_key_value_known(vars, fields, keep_set_fields) do - fields - |> Enum.map(fn %Field{} = field -> + Enum.flat_map(fields, fn %Field{} = field -> single = make_single_case(vars, keep_set_fields, field) single_generated = single != [] @@ -159,7 +158,6 @@ defmodule Protox.DefineDecoder do delimited ++ single end) - |> List.flatten() end defp make_parse_key_value_unknown(vars, keep_set_fields, true = _keep_unknown_fields) do