Browse Source

Use map syntax instead of maps:put/3

Loïc Hoguin 10 years ago
parent
commit
d043148f4a
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/cowboy_req.erl

+ 5 - 5
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.