Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of rustfmt? #273

Open
estebank opened this issue Jul 23, 2024 · 1 comment
Open

Use of rustfmt? #273

estebank opened this issue Jul 23, 2024 · 1 comment

Comments

@estebank
Copy link

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.

@NSoiffer
Copy link
Owner

NSoiffer commented Sep 10, 2024

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 NSoiffer mentioned this issue Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants