Allow setting skip attributes in rustfmt.toml
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
I recently added #![rustfmt::skip::attributes(derive)] to the file at the root of my crate.
This is respected if running rustfmt recursively from the root of my crate.
This is not respected if running rustfmt from any other point within my crate.
I like to repeatedly format the code in the file I am currently writing as I write it.
Current solutions I can think of:
-
Format the entire crate each time instead the individual file.
Performance wise, this is too slow. -
Add
#![rustfmt::skip::attributes(derive)]to every file where I want it respected.
This is messy. -
Write a script to append
#![rustfmt::skip::attributes(derive)]to the head of a file before passing it to rustfmt to be formatted and then remove it again afterward.
Better solutions I can think of:
Allow attribute skips in the rustfmt.toml config file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the difference between formatting recursively from the crate root and formatting an individual file, using the reported rustfmt::skip::attributes(derive) attribute. Then inspect how rustfmt.toml settings and attribute skips are handled; done means a skip-attribute setting in rustfmt.toml is respected when formatting from any point within the crate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100