-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
chore: use rustfmt cli via dprint for faster format #13735
Conversation
@@ -9,8 +9,12 @@ | |||
"json": { | |||
"deno": true | |||
}, | |||
"exec": { | |||
"associations": "**/*.rs", | |||
"rustfmt": "rustfmt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exec plugin has no knowledge of rustfmt
until being provided it here. This makes it call the rustfmt
cli and format over stdin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
A nice side effect is that now rust files get automatically formatted on save if using dprint's vscode extension. |
This PR uses dprint to orchestrate formatting via rustfmt.
Before: 6384ms
After: 932ms (3677ms on the first format or with incremental disabled)
I think part of the previous ~2.5 slowdown was from collecting the file paths. Dprint's CLI has a super fast custom glob walking solution.