Skip to content

Commit

Permalink
Fix the need for a dummy bindings.rs file included in the repo (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfelder authored Dec 13, 2023
1 parent 644aa93 commit d5dd16d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ jobs:
uses: actions/checkout@v3
- name: Check rustfmt
working-directory: ./wrappers/rust
run: if [[ $(cargo fmt --check) ]]; then echo "Please run cargo fmt"; exit 1; fi
# "-name tagret -prune" removes searching in any directory named "target"
# Formatting by single file is necessary due to generated files not being present
# before building the project.
# e.g. icicle-cuda-runtime/src/bindings.rs is generated and icicle-cuda-runtime/src/lib.rs includes that module
# causing rustfmt to fail.
run: if [[ $(find . -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --) ]]; then echo "Please run cargo fmt"; exit 1; fi
# - name: Check clippy
# run: cargo clippy --no-deps --all-features --all-targets

Expand Down
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ use_field_init_shorthand = true
use_try_shorthand = true

# Unstable Configs
# This is required to enable checking single files without checking their imports/submodules
# However, this also breaks running "cargo fmt" at the workspace level
skip_children = true
7 changes: 5 additions & 2 deletions scripts/hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ then
echo ""
echo "If you only want to see what formatting is required please run:"
echo "find ./ \( -path ./icicle/build -prune -o -path ./**/target -prune \) -iname *.h -or -iname *.cuh -or -iname *.cu -or -iname *.c -or -iname *.cpp | xargs clang-format --dry-run -style=file"
echo ""
status=1
fi

Expand All @@ -20,15 +21,17 @@ if [[ $(go list ./... | xargs go fmt) ]];
then
echo "🚨 There are Golang files that need formatting."
echo "Please commit the formatted files"
echo ""
status=1
fi

# Run cargo fmt on Rust files
cd wrappers/rust
if [[ $(cargo fmt --check) ]];
if [[ $(find . -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --) ]];
then
echo "🚨 There are Rust files that need formatting."
echo "Please format the Rust files using 'cargo fmt' from the wrappers/rust directory"
echo "Please format the Rust files using the following command:"
echo "find . -name target -prune -o -iname *.rs -print | xargs cargo fmt --check --"
status=1
fi

Expand Down
2 changes: 0 additions & 2 deletions wrappers/rust/icicle-cuda-runtime/src/bindings.rs

This file was deleted.

0 comments on commit d5dd16d

Please sign in to comment.