{"action":"opened","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/7473","repository_url":"https://api.github.com/repos/elixir-lang/elixir","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/7473/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/7473/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/7473/events","html_url":"https://github.com/elixir-lang/elixir/issues/7473","id":307465529,"number":7473,"title":"`Code.format_string!` Makes certain cases less readable (in my humble opinion)","user":{"login":"athal7","id":467872,"avatar_url":"https://avatars1.githubusercontent.com/u/467872?v=4","gravatar_id":"","url":"https://api.github.com/users/athal7","html_url":"https://github.com/athal7","followers_url":"https://api.github.com/users/athal7/followers","following_url":"https://api.github.com/users/athal7/following{/other_user}","gists_url":"https://api.github.com/users/athal7/gists{/gist_id}","starred_url":"https://api.github.com/users/athal7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/athal7/subscriptions","organizations_url":"https://api.github.com/users/athal7/orgs","repos_url":"https://api.github.com/users/athal7/repos","events_url":"https://api.github.com/users/athal7/events{/privacy}","received_events_url":"https://api.github.com/users/athal7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-22T00:35:01Z","updated_at":"2018-03-22T00:35:01Z","closed_at":null,"author_association":"NONE","body":"### Environment\r\n\r\n* Elixir & Erlang versions (elixir --version): \r\n```bash\r\n$ elixir --version\r\nErlang/OTP 20 [erts-9.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]\r\n\r\nElixir 1.6.2 (compiled with OTP 20)\r\n```\r\n* Operating system: `macOS 10.12.6`\r\n\r\n### Current behavior\r\n\r\n```elixir\r\niex|1 ▶ \"Enum.map([%{foo: 'bar'}], &(&1.foo))\" |> Code.format_string! |> IO.write\r\n\r\nEnum.map([%{foo: 'bar'}], & &1.foo)\r\n```\r\n\r\n```elixir\r\niex|2 ▶ \"\"\"\r\n  with {:ok, user} <- My.Repo.get(User, id),\r\n       {:ok, _}    <- User.authenticate(user, token) do\r\n         {:ok, user}\r\n       else\r\n         _ ->\r\n           {:error, \"Unauthorized\"}\r\n       end\r\n\"\"\" |> Code.format_string! |> IO.write\r\n\r\nwith {:ok, user} <- My.Repo.get(User, id),\r\n     {:ok, _} <- User.authenticate(user, token) do\r\n  {:ok, user}\r\nelse\r\n  _ ->\r\n    {:error, \"Unauthorized\"}\r\nend\r\n```\r\n\r\n### Desired behavior\r\n\r\nKeep parens for short-hand anonymous function:\r\n\r\n```elixir\r\niex|1 ▶ \"Enum.map([%{foo: 'bar'}], &(&1.foo))\" |> Code.format_string! |> IO.write\r\n\r\nEnum.map([%{foo: 'bar'}], &(&1.foo))\r\n```\r\n\r\nKeep vertically aligned match and arrows in with statement (or even better, make it so when it is not yet):\r\n```elixir\r\niex|2 ▶ \"\"\"\r\n  with {:ok, user} <- My.Repo.get(User, id),\r\n       {:ok, _}    <- User.authenticate(user, token) do\r\n         {:ok, user}\r\n       else\r\n         _ ->\r\n           {:error, \"Unauthorized\"}\r\n       end\r\n\"\"\" |> Code.format_string! |> IO.write\r\n\r\nwith {:ok, user} <- My.Repo.get(User, id),\r\n     {:ok, _}    <- User.authenticate(user, token) do\r\n  {:ok, user}\r\nelse\r\n  _ ->\r\n    {:error, \"Unauthorized\"}\r\nend\r\n```\r\n"}}
{"actor":{"display_login":"athal7"}}