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

Add taplo configuration file to format TOML files #1338

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Feb 2, 2024

Taplo is the TOML formatter used by VS Code's TOML extension. https://taplo.tamasfe.dev

I have not added a GitHub Actions job to enforce formatting because it isn't necessarily valuable enough to be something every contributor to this repo needs to install, but I am open to it. Even without a CI job, someone manually running the formatter when things seem to be getting out of shape (a few years apart) would still be positive.

I have not touched the repos directory because I know there is a lot of work in flight by @Kobzol there. It can be formatted afterward. Edit: the formatter-generated changes in that directory are minor.

rylev
rylev previously approved these changes Feb 2, 2024
Copy link
Member

@rylev rylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally in favor of this because my editor already does this.

@weihanglo
Copy link
Member

Not really a blocker. Just wonder what would happen when cargo fmt starts formatting Cargo.toml?

rust-lang/style-team#188

@dtolnay
Copy link
Member Author

dtolnay commented Feb 2, 2024

If the formatting clashes, we would add exclude = [..., "**/Cargo.toml"] in .taplo.toml.

@jackh726
Copy link
Member

jackh726 commented Feb 3, 2024

I think this is a good chance. Semi-minor nit though @dtolnay can you squash to two commits? One with the configuration, and one with the actual formatting changes? (Or, just one commit is fine really)

@dtolnay
Copy link
Member Author

dtolnay commented Feb 3, 2024

Squashed to 2 commits. The first commit is handwritten (only touching .taplo.toml) and the second commit is 100% generated by running taplo format in the repo root.

@rylev rylev merged commit bf6ea71 into rust-lang:master Feb 8, 2024
1 check passed
@dtolnay dtolnay deleted the taplo branch April 8, 2024 20:47
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

Successfully merging this pull request may close these issues.

4 participants