diff --git a/lib/ethers/contract_helpers.ex b/lib/ethers/contract_helpers.ex index 72e0e06..85dae8f 100644 --- a/lib/ethers/contract_helpers.ex +++ b/lib/ethers/contract_helpers.ex @@ -152,10 +152,10 @@ defmodule Ethers.ContractHelpers do selectors |> Enum.uniq_by(& &1.returns) |> Enum.map_join("\n\n### OR\n", fn selector -> - if Enum.count(selector.returns) > 0 do - document_types(selector.returns, selector.return_names) - else + if Enum.empty?(selector.returns) do "This function does not return any values!" + else + document_types(selector.returns, selector.return_names) end end) diff --git a/lib/ethers/tx_data.ex b/lib/ethers/tx_data.ex index 6739beb..791a97a 100644 --- a/lib/ethers/tx_data.ex +++ b/lib/ethers/tx_data.ex @@ -123,7 +123,9 @@ defmodule Ethers.TxData do |> Enum.intersperse(concat(color(",", :operator, opts), break(" "))) returns_doc = - if Enum.count(returns) > 0 do + if Enum.empty?(returns) do + [] + else [ " ", color("returns ", :atom, opts), @@ -132,8 +134,6 @@ defmodule Ethers.TxData do break(""), color(")", :operator, opts) ] - else - [] end default_address = diff --git a/mix.lock b/mix.lock index 8e7f66e..e4b5d72 100644 --- a/mix.lock +++ b/mix.lock @@ -1,7 +1,7 @@ %{ "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "castore": {:hex, :castore, "1.0.16", "8a4f9a7c8b81cda88231a08fe69e3254f16833053b23fa63274b05cbc61d2a1e", [:mix], [], "hexpm", "33689203a0eaaf02fcd0e86eadfbcf1bd636100455350592e7e2628564022aaf"}, - "credo": {:hex, :credo, "1.7.13", "126a0697df6b7b71cd18c81bc92335297839a806b6f62b61d417500d1070ff4e", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "47641e6d2bbff1e241e87695b29f617f1a8f912adea34296fb10ecc3d7e9e84f"}, + "credo": {:hex, :credo, "1.7.15", "283da72eeb2fd3ccf7248f4941a0527efb97afa224bcdef30b4b580bc8258e1c", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "291e8645ea3fea7481829f1e1eb0881b8395db212821338e577a90bf225c5607"}, "dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"}, "earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"}, "erlex": {:hex, :erlex, "0.2.8", "cd8116f20f3c0afe376d1e8d1f0ae2452337729f68be016ea544a72f767d9c12", [:mix], [], "hexpm", "9d66ff9fedf69e49dc3fd12831e12a8a37b76f8651dd21cd45fcf5561a8a7590"},