-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Merged by Bors] - Silence annoying rustfmt config warnings #1508
Conversation
I'd rather if this just didn't check the formatting at all on ci with a non stable toolchain Then always ran |
@DJMcNab Your wish has already been granted! In CI this already only runs on stable Rust. Here's the current config on Lines 36 to 39 in bc4fe9b
Opinion noted. This is really up to the user, unfortunately. We don't place requirements on whether the user uses stable or nightly. This means that a local user may see different results than CI if they're using a different version of Rust than CI's current stable. Unfortunately, I think that's just the reality of how things need to be at the moment. I don't see a way to avoid that unless we constrain what version of Rust a user selects. The topic of which Rust to use was explored starting around here: #1309 (comment) We could add some documentation (a la #1507) stating that you should use the latest stable rust iff you want |
Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
It occurred to me that |
Except 'stable Rust' is exactly the opposite of 'not stable' I'm saying we shouldn't be having these warnings, because it's significantly easier just to only run it in ci on nightly Then we can actually check that the code follows the rustfmt config we have set up And also mean |
Will force pushing allow our changes to be pulled? I don't have a good enough git intuition to determine what will happen here |
@DJMcNab Thank you for clarifying your thoughts. Regarding nightly vs stable, the decision to go ahead with stable was settled on recently in #1309 (comment), so I don't feel like it needs to be rehashed here. Regarding your Git question, forcing is only necessary to add your changes to the index before you commit. No forcing will be necessary during a push, nor will pulling be affected. In other words, special care only needs to be taken by someone who changes the |
I'd seen that but hadn't read it fully - in that case I'd argue we just shouldn't have a And the change to ignore warnings in this PR would not be needed |
AFAIK this would break @cart's desired experience. He uses nightly and wants those options to take effect in his environment. |
I would suggest that in that case he should configure his format on save to be pointed to the new location of rustfmt.toml. When he (anyone) runs the catchup format they would just run |
I'm totally fine doing it whichever way @cart wants. Just let me know! |
My vote is that we move away from aliases entirely in favor of |
And (in a separate pr) I think we should add Users (like me) that want to use nightly features can just set nightly as default, uncomment the relevant nightly config items, and run |
Or (alternatively) users can just run |
@cart Other than doing it in a separate PR, I'm not sure what you want done with |
Yeah sorry I wasn't super clear. I think we should leave |
@cart Ready for another review! I updated the issue to reflect the approach we ended up taking. I'll repeat it here for convenience:
I also updated the documentation on the website in bevyengine/bevy-website#106 |
Ooh i didn't know Great work here. I think we found an ideal path forward :) |
bors r+ |
Silence those [annoying rustfmt config warnings](https://github.com/bevyengine/bevy/pull/1499/checks?check_run_id=1950282111#step:5:66) that happen because we have unstable rustfmt options in `rustfmt.toml`, but we run it in stable on CI. Thanks to @Ratysz for [calling it out](#1499 (comment)). 😄 The final approach we settled on was to comment out the unstable options in `rustfmt.toml`. Those who are using `nightly` may uncomment the unstable options locally if they wish. Once the options stabilize, we can uncomment them again. We also decided that instead of fixing the alias, we would remove the alias entirely so that we do not introduce a custom `.cargo/config.toml` that would conflict with users' custom version of the same file. This means that instead of using a `cargo ci` alias you should use `cargo run -p ci` or `cargo run --package ci` instead. <details><summary>Original Approach (abandoned)</summary> <p> _We decided **not** to go this way..._ In my quest to find a portable way to filter out the warnings I switched the library used to execute commands from `xshell` to `duct` (as advised by the `xshell` project itself when you want to do less simple things). This still uses the "xtask" pattern of using a cargo command alias and a rust project for what would have usually been done with a bash script (on posix), just a different helper library is being used internally. NOTE 1: Also, thanks to some sleuthing by @DJMcNab we were able to fix the broken cargo alias. The issue turned out to be that `.cargo/config.toml` was being ignored because of `.gitignore`. NOTE 2: This is a [known breaking change](#1309 (comment)) for anyone working on bevy who has their own local `.cargo/config.toml`. </p> </details>
Pull request successfully merged into main. Build succeeded: |
I think everyone will be happy with it. 😄 |
Silence those annoying rustfmt config warnings that happen because we have unstable rustfmt options in
rustfmt.toml
, but we run it in stable on CI. Thanks to @Ratysz for calling it out. 😄The final approach we settled on was to comment out the unstable options in
rustfmt.toml
. Those who are usingnightly
may uncomment the unstable options locally if they wish. Once the options stabilize, we can uncomment them again.We also decided that instead of fixing the alias, we would remove the alias entirely so that we do not introduce a custom
.cargo/config.toml
that would conflict with users' custom version of the same file. This means that instead of using acargo ci
alias you should usecargo run -p ci
orcargo run --package ci
instead.Original Approach (abandoned)
We decided not to go this way...
In my quest to find a portable way to filter out the warnings I switched the library used to execute commands from
xshell
toduct
(as advised by thexshell
project itself when you want to do less simple things). This still uses the "xtask" pattern of using a cargo command alias and a rust project for what would have usually been done with a bash script (on posix), just a different helper library is being used internally.NOTE 1: Also, thanks to some sleuthing by @DJMcNab we were able to fix the broken cargo alias. The issue turned out to be that
.cargo/config.toml
was being ignored because of.gitignore
.NOTE 2: This is a known breaking change for anyone working on bevy who has their own local
.cargo/config.toml
.