Commit graph

8 commits

Author SHA1 Message Date
Alice Cecile
e4e32598a9 Cargo fmt with unstable features (#1903)
Fresh version of #1670 off the latest main.

Mostly fixing documentation wrapping.
2021-04-21 23:19:34 +00:00
Martín Maita
1e42de64af Adds rustfmt configs to wrap and limit comment width (#1603)
Aims to close https://github.com/bevyengine/bevy/issues/1594.

These options are unstable and depend on the following PR's:

[wrap_comments](https://rust-lang.github.io/rustfmt/?version=v1.4.36&search=#wrap_comments): https://github.com/rust-lang/rustfmt/issues/3347

[comment_width](https://rust-lang.github.io/rustfmt/?version=v1.4.36&search=#comment_width): https://github.com/rust-lang/rustfmt/issues/3349

[normalize_comments](https://rust-lang.github.io/rustfmt/?version=v1.4.36&search=#normalize_comments): https://github.com/rust-lang/rustfmt/issues/3350

@alice-i-cecile do you think this will solve the issue? When enabled, running the formatter locally should take the configurations into account to format comments. `--check` runs should also be considering them. This should be testable on the `nightly` toolchain.

~I didn't delve into normalizing `//` vs `/* */` though, should I take a look into that too? [normalize_comments](https://rust-lang.github.io/rustfmt/?version=v1.4.36&search=#normalize_comments) seems to be the solution for that but it's also unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3350). I can also add this configuration (commented out, of course) if it's desirable.~ Added `normalize_comments` option.
2021-03-10 01:00:55 +00:00
Nathan Stocks
891f6a1f48 Silence annoying rustfmt config warnings (#1508)
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](https://github.com/bevyengine/bevy/pull/1499#issuecomment-783190586). 😄 

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](https://github.com/bevyengine/bevy/pull/1309#discussion_r564023753) for anyone working on bevy who has their own local `.cargo/config.toml`.
</p>
</details>
2021-03-07 19:50:17 +00:00
Niklas Eicker
89a41bc628
Replace merge_imports with imports_granularity=Crate (#1479)
See rust-lang/rustfmt#4634
2021-02-19 12:05:41 -08:00
Victor "multun" Collod
d138647818 enforce cargo fmt --check 2020-08-16 05:02:06 -07:00
Carter Anderson
7212b70478 rustfmt changes 2020-07-28 14:24:03 -07:00
Carter Anderson
a721f3595d rustfmt: use field init shorthand 2020-02-09 11:43:45 -08:00
Carter Anderson
76d5f6057c add rustfmt.toml and set merge_imports to true 2020-02-09 11:42:26 -08:00