Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra parentheses from tools/fmt.sh #2425

Merged
merged 1 commit into from
May 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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