Open vadimcn opened 6 years ago
Rustfmt can't find comments everywhere so this isn't going to work. The solution is long term and involves having spans for comments either in the AST or our own version of the AST, neither is going to happen soon, unfortunately.
Is there a rustfmt attribute to allow it to format an item except for changing the given line breaks? If not, could there be? Right now I'm using #[rustfmt::skip], but I really just want rustfmt to change everything but my line breaks.
Sometimes I want to insert line breaks in long expressions to better reflect their logical structure. With clang-format this is possible by inserting a line-end comment at the desired break point (even if it's just an empty
//
).As far as I can see, rustfmt just stops formatting such expressions altogether (is this a bug?). It strips empty comments, but that can be worked around with something like
//.
.