You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
separate rust-format or rustfmt tool that does the pretty-printing #3195
It would be really nice to have the pretty printer be good enough to use it as a code formatter, ala gofmt. It still has some issues (I've been working on it), but it is reasonably close to being usable in that way.
But, the commandline invocation is kind of unwieldy (and feels redundant). It seems like --pretty should just pretty print, and other stuff should be handled secondarily, ie with:
Yeah, this is going to move out to a separate tool a la gofmt along with something similar to gofix that has archived copies of old grammars and knows how to migrate code forward between language versions. I'll rename this bug.
if possible, I'd prefer to retain the option (perhaps with -Z) to print out the expanded+identified tree. The reason is that it is very common for me to take a rustc FOO BAR ZED command line and tack on --pretty expanded+identified so that I can know what all the node ids refer to.
Marking as a metabug and collecting in dependencies: #751#850#2951#5181
Also note that https://github.com/dbp/rustfmt does contain a sketch. But the tool frontend is less the hard part. Getting the pp in good enough state to take over is the hard part.
@cmr I was using pretty printer for the formating. But I realized it was pretty broken. It often didn't even parse legit code. I wanted to do some work to improve the pretty printer but I had no time.
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.
Activity
brson commentedon Aug 14, 2012
I would prefer it to be a separate tool.
graydon commentedon Aug 29, 2012
Yeah, this is going to move out to a separate tool a la
gofmtalong with something similar togofixthat has archived copies of old grammars and knows how to migrate code forward between language versions. I'll rename this bug.graydon commentedon Aug 29, 2012
Note: this is a relative bug of #2238
graydon commentedon Apr 25, 2013
nominating for backwards-compatible milestone
nikomatsakis commentedon Apr 25, 2013
if possible, I'd prefer to retain the option (perhaps with -Z) to print out the
expanded+identifiedtree. The reason is that it is very common for me to take arustc FOO BAR ZEDcommand line and tack on--pretty expanded+identifiedso that I can know what all the node ids refer to.graydon commentedon May 7, 2013
Marking as a metabug and collecting in dependencies: #751 #850 #2951 #5181
Also note that https://github.com/dbp/rustfmt does contain a sketch. But the tool frontend is less the hard part. Getting the pp in good enough state to take over is the hard part.
msullivan commentedon Jul 3, 2013
What's the status of this?
emberian commentedon Jul 23, 2013
The pretty printer becomes more and more broken as time goes on. @MaikKlein was working on a separate
rust format, even had a PR for it.MaikKlein commentedon Jul 24, 2013
@cmr I was using pretty printer for the formating. But I realized it was pretty broken. It often didn't even parse legit code. I wanted to do some work to improve the pretty printer but I had no time.
pnkfelix commentedon Oct 11, 2013
cc me
Ryman commentedon May 14, 2014
@pcwalton has a repo relevant to this https://github.com/pcwalton/rustfmt
SirVer commentedon Jan 4, 2015
+1 for this. Feels pretty essential these days with clang-format (great!) and gofmt (so-so) setting standards.
caizixian commentedon Jan 14, 2015
What's the status of this?
steveklabnik commentedon Jan 14, 2015
The status is the same. Would love to have it, don't have one yet.
caizixian commentedon Jan 15, 2015
@steveklabnik Is there any official style guide?
steveklabnik commentedon Jan 15, 2015
https://github.com/rust-lang/rust-guidelines
steveklabnik commentedon Jan 21, 2015
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.
This issue has been moved to the RFCs repo: rust-lang/rfcs#648
Automatic cargo update to 2024-05-20 (rust-lang#3195)
Merge rust-lang#3195