[rustfmt] - can you change the formatting for assignments?

Let's say I want to declare a variable and initialize it to an expression which is too long to fit in the given width limit. When I use rustfmt it moves the expression to the new line, while I would like to achieve the effect you can see in the bottom version in the picture. Is there some rustfmt configuration option that I missed that would make rustfmt use this desired formatting instead of the upper one?

It will only do the upper one if the second line fits in 100 characters, else it will do the bottom one.

Here is a full list of config options.

One can add a trailing comment to one of the lines in the second one to force it to stay in that form.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.