Skip to content

Commit 9ee9b35

Browse files
committed
ci: Run rustfmt on changed files
1 parent d966071 commit 9ee9b35

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.ci/check-style

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set -e
99
set -o pipefail
1010

1111
CLANGFORMAT=${CLANGFORMAT:-clang-format-18}
12+
RUSTFMT=${RUSTFMT:-rustfmt}
1213

1314
command -v git >/dev/null 2>&1 || { echo >&2 "git is missing"; exit 1; }
1415
command -v xargs >/dev/null 2>&1 || { echo >&2 "xargs is missing"; exit 1; }
@@ -37,3 +38,9 @@ if git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep
3738
git --no-pager diff
3839
exit 1
3940
fi
41+
42+
RUST_SOURCES=$(git --no-pager diff --diff-filter=d --name-only ${TARGET_BRANCH} HEAD | grep -E "^src/rust.*\.rs\$" | grep -v -E "^src/rust/vendor" || true)
43+
if [ -n "$RUST_SOURCES" ] ; then
44+
echo $RUST_SOURCES
45+
"$RUSTFMT" --check $RUST_SOURCES
46+
fi

.ci/ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
# Deny warnings in rust. CI will fail to compile any code with warnings in it.
77
export RUSTFLAGS="-Dwarnings"
88

9-
# Check style for C
9+
# Check style for C and Rust
1010
./.ci/check-style
1111

1212
# Check that we can generate protobuf definitions for python

0 commit comments

Comments
 (0)