Should I use skip_children or not? #6345
-
Hi all! I'm trying to fix rustfmt in treefmt-nix to meet their standards with regards to formatters. They require that a formatter only format a single file per file passed. The formatter shouldn't format any of the out of line modules. However, I have been doing some digging into options to ensure that rustfmt does so and that led me to discover the skip_children option. Then, much to my chagrin I discovered that it had been deprecated! Or so I thought. However, turns out that it was only deprecated on the v2 branch and not the v1 branch. Since it was never deprecated on the v1 branch it does still exist. However, it's unclear when it should be used or even how it should be used. If I want to only format the file I requested formatted, and I don't want any file formatted that hasn't been requested, what should I do? Do I use skip_children? If so, how? Thanks for the answers y'all! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you're on nightly you can certainly use You can fully ignore the 2.0 branch, there's not going to be a new major release of rustfmt (outside the entire Rust toolchain having a 2.0 release). We may one day do a soft-deprecation of |
Beta Was this translation helpful? Give feedback.
If you're on nightly you can certainly use
skip_children
, and that's used commonly in situations where people/tools only want to format a single file.You can fully ignore the 2.0 branch, there's not going to be a new major release of rustfmt (outside the entire Rust toolchain having a 2.0 release).
We may one day do a soft-deprecation of
skip_children
(e.g. instead ofskip_children
with a default offalse
we could have something likeformat_children
with a default oftrue
to avoid the double negative, but we also maintain automatic mappings for these types of cases)