diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b15244baa..54f869acc 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -44,7 +44,7 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - name: Check formatting - run: cargo fmt --all -- --check --config imports_granularity=Crate + run: cargo fmt --all -- --check --config "imports_granularity=Crate,group_imports=StdExternalCrate" - name: Clippy if: ${{ success() || failure() }} diff --git a/pre-commit b/pre-commit index ccb0418d5..e5846d02e 100755 --- a/pre-commit +++ b/pre-commit @@ -53,9 +53,11 @@ stashfile=$(mktemp .pre-commit.stashXXXXXX) trap 'set +e;git stash pop -q; rm -f "$stashfile"; restore_merge_files' EXIT save_merge_files git stash push -k -u -q -m "pre-commit stash" -if ! errors=($(cargo fmt -- --check --config imports_granularity=Crate -l)); then + +fmtconfig="imports_granularity=Crate,group_imports=StdExternalCrate" +if ! errors=($(cargo fmt --all -- --check --config "$fmtconfig" -l)); then echo "Formatting errors found." - echo "Run \`cargo fmt -- --config imports_granularity=Crate\` to fix the following files:" + echo "Run \`cargo fmt --all -- --config \"$fmtconfig\"\` to fix the following files:" for err in "${errors[@]}"; do echo " $err" done @@ -102,4 +104,4 @@ check "Sort benchmark" \ check "ipa-macros tests" \ pushd ipa-macros && cargo test --features="trybuild" && popd - \ No newline at end of file +