-
Notifications
You must be signed in to change notification settings - Fork 898
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
[unstable option] space_before_colon #3365
Comments
(Please excuse if this does not belong here) Is there a way (planned) to distinguish between a parameter list, let statement, and other uses of the type annotation colon? I would like to have my code formatted so that let my_string : String = "hello".to_string(); has a space before the colon, because the colon feels like it separates the type from the identifier. fn foo( my_arg: String, another_arg: &str) {
} because the type belongs to its preceeding argument and it feels like it is too close to the next parameter when I have the space before the colon. Of course, tastes may vary. And it's not that important to be able to distinguish these cases. But I'd like to, if it was easily doable. |
My thoughts as well, but to say it in one rule: The colon belongs with the type when the type is optional. Because they are added or removed together. Just like in UML. I can think of 3 uses of colon:
I would also remove the space after the colon (#3366) by the exact same rule, but maybe that's just me. |
I just think it looks more readable with the space before the colon across the board. ML-heritage showing 😄 |
Tracking issue for unstable option: space_before_colon
The text was updated successfully, but these errors were encountered: