Rustfmt questions

Where can I ask questions about rustfmt?
Got it working (with nightly build).
If the answer is: "here" than the question:

Basically I want rustfmt to do nothing except:
-remove traling spaces
-correct the indenting

and not
-making one-liners if I put it on separate lines.
-make multiple lines if I put it on one line.

Is that possible?

Rustfmt's configuration options are listed and documented here. I personally don't know the options you have to set for your desired configuration, or if what you are asking is even possible.

Yes I know. browsing there :slight_smile:

What you want is probably just your editor’s/IDE’s autoindent and whitespace-trimming functions. Rustfmt cannot be configured to preserve all user newlines (in general it ignores all user whitespace), it is somewhat opinionated by design.

A general tip if you want to allow it to format a bit more is that you can opt out of formatting specific parts with the #[rustfmt::skip] attribute. I have used it for matrices, for example. I understand if this is not what you were looking for, considering a previous topic, but it's worth mentioning.

That at least leaves my arrays intact! Thanks I will try that one.

2 Likes