MathCAT icon indicating copy to clipboard operation
MathCAT copied to clipboard

Use of rustfmt?

Open estebank opened this issue 1 year ago • 1 comments

Hi! I couldn't help but notice that the codebase doesn't use rustfmt. Are there any specific reasons for that? If there are limitations in the rustfmt itself that could be addressed it would be useful to hear about them upstream.

Feel free to close this ticket as off-topic.

estebank avatar Jul 23 '24 23:07 estebank

Thanks for looking at this. My non-use was most ignorance of the tool. I just tried it and I like a lot of what it corrects, but I found a few things that make me hesitant to use it:

  1. I sometimes try to align comments like
   let foo = "short string";                        // first comment
   let bar = "this is a much larger string";        // second comment

rustfmt wants to make the comments tight. I didn't see an option to avoid this. In fact, I'd like to see an option that would align comments. It would need some extra option to control how many lines it should look at to do the alignment. For example, if there was a line between the two lines above, I might still want to align the comments. However, probably not if there was a 10 line gap. 2. I sometimes add spaces or break something across lines for clarity. Is there a way to tell rustfmt to ignore the following statement? 3. rustfmt wants to add space around operators. Normally good, but here's an example where I don't like it:

-            return (braille, start/3, end/3);
+            return (braille, start / 3, end / 3);

In the way I wrote it, I find it makes the arguments clearer than when they get spaced out in the second line. Again, being able to easily override rustfmt for this line would be helpful.

NSoiffer avatar Sep 10 '24 19:09 NSoiffer