Skip to content

Commit

Permalink
refactor: use Enum.flat_map/2
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamez committed Oct 31, 2024
1 parent 9e48766 commit e71019a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/protox/define_decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,14 @@ 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 != []
delimited = make_delimited_case(vars, keep_set_fields, single_generated, field)

delimited ++ single
end)
|> List.flatten()
end

defp make_parse_key_value_unknown(vars, keep_set_fields, true = _keep_unknown_fields) do
Expand Down

0 comments on commit e71019a

Please sign in to comment.