From 578f46c008a647edda8001eef966b396c7b9b8bb Mon Sep 17 00:00:00 2001 From: kerty Date: Sun, 26 Oct 2025 13:32:52 +0100 Subject: [PATCH] build_tools/style.fish: improve style and consistency --- build_tools/style.fish | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/build_tools/style.fish b/build_tools/style.fish index a1705d2b9..0cc612bf5 100755 --- a/build_tools/style.fish +++ b/build_tools/style.fish @@ -93,28 +93,26 @@ if set -q python_files[1] end end -if not cargo fmt --version >/dev/null - echo - echo $yellow'Please install "rustfmt" to style Rust, e.g. via:' - echo "rustup component add rustfmt"$normal - exit 127 -end -echo === Running "$green"rustfmt"$normal" -if set -l -q _flag_check - if test $all = yes - cargo fmt --all --check +if test $all = yes; or set -q rust_files[1] + if not cargo fmt --version >/dev/null + echo + echo $yellow'Please install "rustfmt" to style Rust, e.g. via:' + echo "rustup component add rustfmt"$normal + exit 127 + end + + echo === Running "$green"rustfmt"$normal" + if set -l -q _flag_check + if test $all = yes + cargo fmt --all --check + else + rustfmt --check --files-with-diff $rust_files + end or die "Rust files are not formatted correctly." else - if set -q rust_files[1] - rustfmt --check --files-with-diff $rust_files - or die "Rust files are not formatted correctly." - end - end -else - if test $all = yes - cargo fmt --all - else - if set -q rust_files[1] + if test $all = yes + cargo fmt --all + else rustfmt $rust_files end end