Skip to content

Commit

Permalink
Silence annoying rustfmt config warnings (#1508)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
CleanCut committed Mar 7, 2021
1 parent dabf419 commit 891f6a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Check the format
# See tools/ci/src/main.rs for the commands this runs
run: cargo run --package ci
run: cargo run -p ci
if: runner.os == 'linux' && matrix.toolchain == 'stable'

- name: Build & run tests
Expand Down
9 changes: 6 additions & 3 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
unstable_features = true
imports_granularity = "Crate"
use_field_init_shorthand = true
reorder_impl_items = true
newline_style = "Unix"

# The following lines may be uncommented on nightly Rust.
# Once these features have stabilized, they should be added to the always-enabled options above.
#unstable_features = true
#imports_granularity = "Crate"
#reorder_impl_items = true

0 comments on commit 891f6a1

Please sign in to comment.