Per-type skip
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
As discussed in #2924 and "hinted" in #2555 and maybe others, a per-type skip would be nice. I don't have tens of use-case, in fact I have only one: the matrix. In our computer graphic application, we define a lot of matrices in several modules, thus making #[rustfmt::skip] uninteresting. What I (and probably many others) want is something like
// in lib.rs or mod.rs. Or top of a file?
#[rustfmt::skip(Matrix3, Matrix4)]
because I can't imagine a single case where I would want rustfmt to format my matrices. The only right way to format a 3x3 matrix is when it has 3 columns and 3 rows. All in one line or in one row is unreadable.
I don't know rustfmt code at all, nor what it could possibly do. Do you have access to the base type when parsing the files? I ask because I wonder if an alias type Affine = Matrix3<f64> would force the user too add all aliases in the skip, if such a feature existed.
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 reviewing the discussion in issues #2924 and #2555, then trace how rustfmt currently handles #[rustfmt::skip]. Define the behavior for per-type skips, including whether type aliases such as Affine = Matrix3 must be listed, and consider how the requested matrix formatting should be validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100