-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7757a53
commit 808f2a7
Showing
12 changed files
with
521 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# Comes from <https://stackoverflow.com/a/71222423/10967642>. | ||
|
||
exe=$(which rustfmt) | ||
|
||
if [ -n "$exe" ] | ||
then | ||
# field separator to the new line | ||
IFS=$'\n' | ||
|
||
for line in $(git status -s) | ||
do | ||
# if added or modified | ||
if [[ $line == A* || $line == M* ]] | ||
then | ||
# check file extension | ||
if [[ $line == *.rs ]] | ||
then | ||
# format file | ||
rustfmt --edition 2021 -l -- $(pwd)/${line:3} | ||
# add changes | ||
git add $(pwd)/${line:3} | ||
fi | ||
fi | ||
done | ||
else | ||
echo "rustfmt was not found" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
array_width = 48 | ||
fn_params_layout = "Vertical" | ||
group_imports = "StdExternalCrate" | ||
imports_granularity = "Module" | ||
match_block_trailing_comma = true | ||
overflow_delimited_expr = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.