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

Improve formatting of ranges whose start/end contain binary operators #204

Open
joshtriplett opened this issue Jan 7, 2025 · 1 comment

Comments

@joshtriplett
Copy link
Member

An example:

count_hash + 2..s.len() - count_hash - 1

The spacing is confusing and doesn't match the precedence.

I think we should format this like:

(count_hash + 2)..(s.len() - count_hash - 1)

Note that I only think we should parenthesize endpoints when needed for clarity, so for instance:

count_hash..(s.len() - count_hash - 1)

@Licenser
Copy link

Licenser commented Jan 7, 2025

Yes pleeeeaassseee, that would be such a nice improvement!

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