-
Notifications
You must be signed in to change notification settings - Fork 888
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
Stabilize the ignore
configuration
#3243
Comments
The question I guess is do we think that we really want this config option (which I think the answer is 'yes') and if it has the right options, or at least, are they forward compatible with the right options. |
What's the right way to move forward with this then? IMHO it would be nicer to rename the configuration to The only way how I can currently imagine how this could be extended is to make it possible to provide module names, or generally paths to items in the code. But then this would basically duplicate the |
So, one bigger thought is whether we want to control non-formatting things using rustfmt.toml, or whether we should have a separate configuration file. I think changing the name to What is your use case for this? |
I have a crate that contains quite some autogenerated code, and I want to run rustfmt only over all the other code. The autogenerated code is in the repo because a) generation is non-trivial and b) having the code in the repo allows tracking changes better. |
#3279 would be another solution for me |
If this is inside a lib or a module, it would be better to control inside the source code itself and not on the |
Yeah, I think having the code generator also generate |
Having an ignore option stabilised and in |
Two things, both related to ignoring everything.
Basically I got stung while working on Rocket (which doesn't use rustfmt) because my vim automatically runs A way to solve this problem is for packages that can't/don't want to use rustfmt to add a |
@derekdreery |
Can confirm that works - could it be made more discoverable? |
@derekdreery The configuration file https://github.com/rust-lang/rustfmt/blob/e0664662b49c1ed3e99391c51132ddf01cd87c79/Configurations.md#ignore has been updated few days ago with an example about this. |
Awesome, exactly what I wanted :) |
Any progress on it? |
If the intention is to mimic Having The downside is that there is yet another file in the repository. Many tools in the JS ecosystem for example allow you to put your configuration under a special key in the This idea could obviously be implemented regardless of whether |
Is there an existing issue for this? |
@hayd Not that I am aware of. |
This option was supposedly stabilized, but someone posted in #4139 that it is reporting as unstable. I added my own output there, too. |
|
@dnsco I think this comment does a good job of explaining things: #4139 (comment), and the tracking issue is for stabilization can be found at #3395. To see if a given option is stable or not you can check Configurations.md, and more specifically here are the docs on ignore |
@ytmimi thank you. |
This issue should be reopened, if I've understood the discussion correctly (and in particular #4139 (comment) .) The option is still unstable; the PR that closed it was closing it for an exploratory potential 2.0 which didn't become a release. There's also the issue #3395, which sounds very similar. I'm not sure if these two issues should be seen as duplicates, or if there's an intentional workflow distinction that results in two separate related issues. If they are to be taken as duplicates, though, this thread is both the older of the two and the one where substantive discussion has happened; so it seems like #3395 should be closed in that case and this one reopened. |
Can I ask why this issue is closed? The "ignore" feature still doesn't work:
with
I don't control the formatting of my vendored third party submodules. But cannot make CI pass because I cannot tell rustfmt to stop scolding me for things I do not have control over. This seems undesirable and broken. |
@rdaum the option is currently unstable and you'll need to use a nightly version of rustfmt if you want to use the |
I agree that it's a bit confusing. This was closed a long time ago when changes were merged into an experimental 2.0 branch that never got released. As I mentioned in #3243 (comment), I think the comment made by Caleb #4139 (comment) does a good job of explaining the situation. #3395 is the tracking issue for stabilization and I'd recommend relying on it as an indicator for when the option will be stabilized. |
I was having problem with the diesel schema.rs generation format. Using the rustfmt.toml to ignore the file didn't work, returning "unstable features are only available in nightly channel." Resolved using: #[rustfmt::skip]
pub mod schema; |
Glad that you found a workaround. Yeah, |
This one does not affect how the code is formatted but allows specific files or directories to be excluded from formatting.
What is needed for stabilizing this for one of the next releases?
The text was updated successfully, but these errors were encountered: