aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-07-27 17:32:05 +0200
committerLoïc Hoguin <[email protected]>2015-07-27 17:32:05 +0200
commitd043148f4a9f5fa4ca4407c166ee15a6a17cff8c (patch)
tree9d600dd832206cf4330f411236fab499ed6d9a3b
parentccd786baee23fd3432c78ed2569b644ecb96f1d2 (diff)
downloadcowboy-d043148f4a9f5fa4ca4407c166ee15a6a17cff8c.tar.gz
cowboy-d043148f4a9f5fa4ca4407c166ee15a6a17cff8c.tar.bz2
cowboy-d043148f4a9f5fa4ca4407c166ee15a6a17cff8c.zip
Use map syntax instead of maps:put/3
-rw-r--r--src/cowboy_req.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 8726779..b13da50 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -1194,13 +1194,13 @@ kvlist_to_map(Keys, [{Key, Value}|Tail], Map) ->
case maps:find(Atom, Map) of
{ok, MapValue} when is_list(MapValue) ->
kvlist_to_map(Keys, Tail,
- maps:put(Atom, [Value|MapValue], Map));
+ Map#{Atom => [Value|MapValue]});
{ok, MapValue} ->
kvlist_to_map(Keys, Tail,
- maps:put(Atom, [Value, MapValue], Map));
+ Map#{Atom => [Value, MapValue]});
error ->
kvlist_to_map(Keys, Tail,
- maps:put(Atom, Value, Map))
+ Map#{Atom => Value})
end;
false ->
kvlist_to_map(Keys, Tail, Map)
@@ -1221,7 +1221,7 @@ filter([{Key, Constraints, Default}|Tail], Map) ->
{ok, Value} ->
filter_constraints(Tail, Map, Key, Value, Constraints);
error ->
- filter(Tail, maps:put(Key, Default, Map))
+ filter(Tail, Map#{Key => Default})
end;
filter([Key|Tail], Map) ->
true = maps:is_key(Key, Map),
@@ -1232,7 +1232,7 @@ filter_constraints(Tail, Map, Key, Value, Constraints) ->
true ->
filter(Tail, Map);
{true, Value2} ->
- filter(Tail, maps:put(Key, Value2, Map))
+ filter(Tail, Map#{Key => Value2})
end.
%% Tests.