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

Please provide special case for name=name in format #3861

Closed
joshtriplett opened this issue Oct 13, 2019 · 3 comments
Closed

Please provide special case for name=name in format #3861

joshtriplett opened this issue Oct 13, 2019 · 3 comments

Comments

@joshtriplett
Copy link
Member

I'd like to avoid reformats like this:

-                v.push(new.paint(format!("{:nwidth$}: {:idwidth$}", i2 + offset, c2_short_id, nwidth=nwidth, idwidth=idwidth).as_bytes().to_owned()));
+                v.push(new.paint(format!("{:nwidth$}: {:idwidth$}", i2 + offset, c2_short_id, nwidth = nwidth, idwidth = idwidth).as_bytes().to_owned()));

Could we special-case samename=samename in the arguments of format!-like macros, and avoid adding spaces around the =?

@topecongiro
Copy link
Contributor

This seems a bit too narrow to special-case in rustfmt.

@joshtriplett
Copy link
Member Author

It ends up producing a lot of noise when you have a long list of x=x, y=y, z=z in a format-like call, and rustfmt already has special-case logic for format-like calls.

@joshtriplett
Copy link
Member Author

Nevermind, I think rust-lang/rfcs#2795 would fully address the cases where I find myself wanting this.

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