From 7f26ad85c21dc2a260307aed46efb0c31c135c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=B0=B1=E5=83=8F=E5=B1=8E=E7=9A=84=E5=80=92?= =?UTF-8?q?=E5=BD=B1?= Date: Mon, 4 Oct 2021 14:36:17 +0800 Subject: [PATCH] fmt: ignore the target dir when formatting (#4145) Signed-off-by: hi-rustin --- .github/workflows/ci.yml | 4 ++-- CONTRIBUTING.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49be1f456..c28845450 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -264,8 +264,8 @@ jobs: - name: "rustfmt --check" # Workaround for rust-lang/cargo#7732 run: | - if ! rustfmt --check --edition 2018 $(find . -name '*.rs' -print); then - printf "Please run \`rustfmt --edition 2018 \$(find . -name '*.rs' -print)\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 + if ! rustfmt --check --edition 2018 $(git ls-files '*.rs'); then + printf "Please run \`rustfmt --edition 2018 \$(git ls-files '*.rs')\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 exit 1 fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 62d35864c..66ec614e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,7 +150,7 @@ command below instead: ``` # Mac or Linux -rustfmt --check --edition 2018 $(find . -name '*.rs' -print) +rustfmt --check --edition 2018 $(git ls-files '*.rs') # Powershell Get-ChildItem . -Filter "*.rs" -Recurse | foreach { rustfmt --check --edition 2018 $_.FullName }