Skip to content

Commit

Permalink
Remove extra parentheses from tools/fmt.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 10, 2021
1 parent f0444cb commit b96e27a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tools/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Usage:
# ./tools/fmt.sh
#
# This script is needed because `cargo fmt` cannot recognize modules defined inside macros.
# This is similar to `cargo fmt`, but unlike `cargo fmt`, it can recognize
# modules defined inside macros.
# Refs: https://github.com/rust-lang/rustfmt/issues/4078

set -euo pipefail
Expand All @@ -15,12 +16,13 @@ cd "$(cd "$(dirname "${0}")" && pwd)"/..

# shellcheck disable=SC2046
if [[ -z "${CI:-}" ]]; then
(
# `cargo fmt` cannot recognize modules defined inside macros so run rustfmt directly.
rustfmt $(git ls-files "*.rs")
)
# `cargo fmt` cannot recognize modules defined inside macros, so run
# rustfmt directly.
# Refs: https://github.com/rust-lang/rustfmt/issues/4078
rustfmt $(git ls-files "*.rs")
else
(
rustfmt --check $(git ls-files "*.rs")
)
# `cargo fmt` cannot recognize modules defined inside macros, so run
# rustfmt directly.
# Refs: https://github.com/rust-lang/rustfmt/issues/4078
rustfmt --check $(git ls-files "*.rs")
fi

0 comments on commit b96e27a

Please sign in to comment.