File tree 8 files changed +32
-24
lines changed
8 files changed +32
-24
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # :
3
+ # : name = "lint"
4
+ # : variety = "basic"
5
+ # : target = "helios-2.0"
6
+ # : rust_toolchain = "nightly-2024-05-12"
7
+ # : access_repos = [
8
+ # : "oxidecomputer/illumos-rs",
9
+ # : ]
10
+ # :
11
+
12
+ set -o errexit
13
+ set -o pipefail
14
+ set -o xtrace
15
+
16
+ header " check style"
17
+ ptime -m cargo xtask fmt --check
Original file line number Diff line number Diff line change @@ -26,9 +26,6 @@ cd crates/opte-api
26
26
header " check API_VERSION"
27
27
./check-api-version.sh
28
28
29
- header " check style"
30
- ptime -m cargo +nightly-2024-05-12 fmt -- --check
31
-
32
29
header " analyze std"
33
30
ptime -m cargo clippy --all-targets
34
31
Original file line number Diff line number Diff line change @@ -23,8 +23,5 @@ rustc --version
23
23
24
24
cd lib/opte-ioctl
25
25
26
- header " check style"
27
- ptime -m cargo +nightly-2024-05-12 fmt -- --check
28
-
29
26
header " analyze"
30
27
ptime -m cargo clippy --all-targets
Original file line number Diff line number Diff line change @@ -25,9 +25,6 @@ rustc --version
25
25
26
26
cd lib/opte
27
27
28
- header " check style"
29
- ptime -m cargo +nightly-2024-05-12 fmt -- --check
30
-
31
28
header " check docs"
32
29
#
33
30
# I believe this means any doc warnings in deps will cause this to
Original file line number Diff line number Diff line change @@ -28,9 +28,6 @@ rustc --version
28
28
29
29
pushd bin/opteadm
30
30
31
- header " check style"
32
- ptime -m cargo +nightly-2024-05-12 fmt -- --check
33
-
34
31
header " analyze"
35
32
ptime -m cargo clippy --all-targets
36
33
Original file line number Diff line number Diff line change @@ -25,9 +25,6 @@ rustc --version
25
25
26
26
cd lib/oxide-vpc
27
27
28
- header " check style"
29
- ptime -m cargo +nightly-2024-05-12 fmt -- --check
30
-
31
28
header " check docs"
32
29
#
33
30
# I believe this means any doc warnings in deps will cause this to
Original file line number Diff line number Diff line change @@ -78,9 +78,6 @@ pushd xde
78
78
79
79
cp xde.conf /work/xde.conf
80
80
81
- header " check style"
82
- ptime -m cargo +nightly-2024-05-12 fmt -p xde -p xde-link -- --check
83
-
84
81
header " analyze"
85
82
ptime -m cargo clippy -- \
86
83
--allow clippy::uninlined-format-args --allow clippy::bad_bit_mask
Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ enum Xtask {
61
61
} ,
62
62
63
63
/// Format the repository with `rustfmt`.
64
- Fmt ,
64
+ Fmt {
65
+ /// Run rustfmt in check mode.
66
+ #[ arg( long) ]
67
+ check : bool ,
68
+ } ,
65
69
}
66
70
67
71
#[ derive( Debug , Args ) ]
@@ -140,17 +144,22 @@ fn main() -> anyhow::Result<()> {
140
144
141
145
Ok ( ( ) )
142
146
}
143
- Xtask :: Fmt => {
147
+ Xtask :: Fmt { check } => {
144
148
let meta = cargo_meta ( ) ;
145
149
146
150
// This is explicitly `cargo` rather than CARGO as we might
147
151
// be swapping toolchains to do this from the current cargo.
148
- Command :: new ( "cargo" )
149
- . arg ( format ! ( "+{}" , get_current_nightly_toolchain( ) ?) )
152
+ let mut c = Command :: new ( "cargo" ) ;
153
+ c . arg ( format ! ( "+{}" , get_current_nightly_toolchain( ) ?) )
150
154
. args ( [ "fmt" , "--all" ] )
151
155
. env_remove ( "RUSTUP_TOOLCHAIN" )
152
- . current_dir ( & meta. workspace_root )
153
- . output_nocapture ( ) ?;
156
+ . current_dir ( & meta. workspace_root ) ;
157
+
158
+ if check {
159
+ c. arg ( "--check" ) ;
160
+ }
161
+
162
+ c. output_nocapture ( ) ?;
154
163
155
164
Ok ( ( ) )
156
165
}
You can’t perform that action at this time.
0 commit comments