File tree 1 file changed +17
-8
lines changed
1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -36,22 +36,31 @@ cd ..
36
36
cargo +nightly fmt --all -- --check
37
37
38
38
39
- # avoid loop spam
40
- set +x
39
+
40
+
41
41
# make sure tests are formatted
42
42
43
43
# some lints are sensitive to formatting, exclude some files
44
- needs_formatting =false
44
+ tests_need_reformatting =false
45
45
# switch to nightly
46
46
rustup default nightly
47
+ # avoid loop spam and allow cmds with exit status != 0
48
+ set +ex
49
+
47
50
for file in ` find tests -not -path " tests/ui/methods.rs" -not -path " tests/ui/format.rs" -not -path " tests/ui/formatting.rs" -not -path " tests/ui/empty_line_after_outer_attribute.rs" -not -path " tests/ui/double_parens.rs" -not -path " tests/ui/doc.rs" -not -path " tests/ui/unused_unit.rs" | grep " \.rs$" ` ; do
48
- rustfmt ${file} --check || echo " ${file} needs reformatting!" ; needs_formatting=true
51
+ rustfmt ${file} --check
52
+ if [ $? -ne 0 ]; then
53
+ echo " ${file} needs reformatting!"
54
+ tests_need_reformatting=true
55
+ fi
49
56
done
50
- # switch back to master
51
- rustup default master
52
57
53
- if [ " ${needs_reformatting} " = true ] ; then
58
+ set -ex # reset
59
+
60
+ if [ ${tests_need_reformatting} ] ; then
54
61
echo " Tests need reformatting!"
55
62
exit 2
56
63
fi
57
- set -x
64
+
65
+ # switch back to master
66
+ rustup default master
You can’t perform that action at this time.
0 commit comments