Skip to content

Commit

Permalink
Use proper to_binary-functions instead of converting to list then bin…
Browse files Browse the repository at this point in the history
…ary.
  • Loading branch information
Emil Falk committed Jul 11, 2017
1 parent 0951eff commit b652250
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/eredis.erl
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ to_bulk(B) when is_binary(B) ->
%% as we do not want floats to be stored in Redis. Your future self
%% will thank you for this.
to_binary(X) when is_list(X) -> list_to_binary(X);
to_binary(X) when is_atom(X) -> list_to_binary(atom_to_list(X));
to_binary(X) when is_atom(X) -> atom_to_binary(X, utf8);
to_binary(X) when is_binary(X) -> X;
to_binary(X) when is_integer(X) -> list_to_binary(integer_to_list(X));
to_binary(X) when is_integer(X) -> integer_to_binary(X);
to_binary(X) when is_float(X) -> throw({cannot_store_floats, X});
to_binary(X) -> term_to_binary(X).

0 comments on commit b652250

Please sign in to comment.