Elixir Formatter: conn.assigns[:current_user] becomes conn.assigns()[:current_user]

I am using the current master, installed locally to format the project I am working on so it’s future-proof in terms of formatting and style.

In several places, I had the following construct:

conn.assigns[:current_user]

that, formatter, updates to:

conn.assigns()[:current_user]

It’s not a biggie, I do expect this to always be assigned so I did update to conn.assigns.current_user in the end, but the questions of why did formatter do this and is it correct behavior keeps me up at night ;).

Any ideas?

1 Like

Are you using latest Elixir master? I can’t reproduce this:

iex(1)> Code.format_string!("conn.assigns[:current_user]") |> IO.puts
conn.assigns[:current_user]
:ok

:+1:

2 Likes

Ah, stupid me. I upgraded to up-to-date master (I thought it was but apparently not). Problem solved.

Edit: I might have had it set to a branch where I was playing with formatter and now that I think of it’s very much likely I have broken this myself in first place.