Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,3 @@ edition = "2021"
style_edition = "2024"
use_small_heuristics = "Max"
merge_derives = false

ignore = [
"**/build/",
"**/target/",

# Do not format submodules
# For some reason, this is not working without the directory wildcard.
"**/firecracker",
"**/tests/perf/s2n-quic/",
]
14 changes: 10 additions & 4 deletions scripts/kani-fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,25 @@ error=0
cargo fmt "$@" || error=1

# Check test source files.
# Note that this will respect the ignore section of rustfmt.toml. If you need to
# skip any file / directory, add it there.
TESTS=("tests" "docs/src/tutorial")
# Add ignore patterns for code we don't want to format.
IGNORE=("*/perf/s2n-quic/*")

# Arguments for the find command for excluding the IGNORE paths
IGNORE_ARGS=()
for ignore in "${IGNORE[@]}"; do
IGNORE_ARGS+=(-not -path "$ignore")
done

for suite in "${TESTS[@]}"; do
# Find uses breakline to split between files. This ensures that we can
# handle files with space in their path.
set -f; IFS=$'\n'
files=($(find "${suite}" -name "*.rs"))
files=($(find "${suite}" -name "*.rs" ${IGNORE_ARGS[@]}))
set +f; unset IFS
# Note: We set the configuration file here because some submodules have
# their own configuration file.
rustfmt --unstable-features "$@" --config-path rustfmt.toml "${files[@]}" || error=1
rustfmt --config-path rustfmt.toml "${files[@]}" || error=1
done

exit $error
Loading