1
0
mirror of https://github.com/containers/youki synced 2024-11-22 08:51:59 +01:00

Add rustfmt.toml to standardize formatting

Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
This commit is contained in:
Jorge Prendes 2024-05-15 13:20:42 +01:00
parent 25edc95648
commit bdd4f5c674
3 changed files with 12 additions and 1 deletions

@ -44,7 +44,9 @@ jobs:
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
components: clippy
- name: Install nightly rustfmt
run: rustup toolchain install nightly --component rustfmt --profile minimal --no-self-update
- name: typos-action
uses: crate-ci/typos@v1.14.12
- name: Install just

6
rustfmt.toml Normal file

@ -0,0 +1,6 @@
newline_style = "Native"
unstable_features = true # Cargo fmt now needs to be called with `cargo +nightly fmt`
group_imports = "StdExternalCrate" # create three groups for std, external and local crates
# Merge imports from the same module
# See: https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#imports_granularity
imports_granularity = "Module"

@ -48,6 +48,9 @@ if [ "$1" == "fmt" ]; then
# running cargo fmt fails when run through cross
# also cargo fmt is platform independent
CARGO="cargo"
# Use nightly for `cargo fmt` as `rustfmt.toml` uses unstable features.
set -- "+nightly" "$@"
fi
if [ "$CARGO" == "cross" ]; then