File tree Expand file tree Collapse file tree 1 file changed +9
-25
lines changed Expand file tree Collapse file tree 1 file changed +9
-25
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /bin/sh
2
2
# Format existing exercises using rustfmt
3
3
4
4
RUST_TRACK_REPO_PATH=$( cd " $( dirname " $0 " ) /.." && pwd)
5
5
6
6
EXERCISES_PATH=" ${RUST_TRACK_REPO_PATH} /exercises/"
7
7
8
- # Some exercises use custom formatting for illustration purpose and should not be formatted.
9
- IGNORED_EXERCISES=(
10
- " diamond"
11
- " minesweeper"
12
- " rectangles"
13
- )
14
-
15
- # Iterate over every exercise directory and if it is not ignored - format it
16
8
for exercise_dir in ${EXERCISES_PATH} /* ; do
17
- exercise_name=${exercise_dir##*/ }
18
-
19
- if [[ " ${IGNORED_EXERCISES[*]} " == * " $exercise_name " * ]]; then
20
- echo " $exercise_name - Ignored"
21
- else
22
- (
23
- echo " $exercise_name - Formatting"
24
-
25
- cd " $exercise_dir "
26
-
27
- cargo fmt
28
-
29
- [ -f example.rs ] && rustfmt example.rs
30
- )
31
- fi
32
-
9
+ exercise_name=$( basename $exercise_dir )
10
+ (
11
+ cd " $exercise_dir "
12
+ cargo fmt
13
+ if [ -f example.rs ]; then
14
+ rustfmt example.rs
15
+ fi
16
+ )
33
17
done
You can’t perform that action at this time.
0 commit comments