@@ -42,9 +42,12 @@ pub(crate) struct BenchTargetFilters {
42
42
pub ( crate ) bench : Option < Vec < String > > ,
43
43
}
44
44
45
+ // Help headings, should mostly match the headers from cargo build --help
45
46
const FEATURE_HELP : & str = "Feature Selection" ;
46
47
const COMPILATION_HELP : & str = "Compilation Options" ;
47
48
const TARGET_HELP : & str = "Target Selection" ;
49
+ const MANIFEST_HELP : & str = "Manifest Options" ;
50
+
48
51
#[ derive( Subcommand ) ]
49
52
enum Commands {
50
53
/// Build the benchmarks
@@ -72,6 +75,18 @@ enum Commands {
72
75
#[ arg( long, default_value = "bench" , help_heading = COMPILATION_HELP ) ]
73
76
profile : String ,
74
77
78
+ /// Assert that `Cargo.lock` will remain unchanged
79
+ #[ arg( long, help_heading = MANIFEST_HELP ) ]
80
+ locked : bool ,
81
+
82
+ /// Run without accessing the network
83
+ #[ arg( long, help_heading = MANIFEST_HELP ) ]
84
+ offline : bool ,
85
+
86
+ /// Equivalent to specifying both --locked and --offline
87
+ #[ arg( long, help_heading = MANIFEST_HELP ) ]
88
+ frozen : bool ,
89
+
75
90
#[ command( flatten) ]
76
91
bench_target_filters : BenchTargetFilters ,
77
92
} ,
@@ -104,22 +119,30 @@ pub fn run(args: impl Iterator<Item = OsString>) -> Result<()> {
104
119
jobs,
105
120
no_default_features,
106
121
profile,
122
+ locked,
123
+ offline,
124
+ frozen,
107
125
} => {
108
126
let passthrough_flags = {
109
127
let mut passthrough_flags = Vec :: new ( ) ;
110
-
111
128
if all_features {
112
129
passthrough_flags. push ( "--all-features" . to_string ( ) ) ;
113
130
}
114
-
115
131
if no_default_features {
116
132
passthrough_flags. push ( "--no-default-features" . to_string ( ) ) ;
117
133
}
118
-
134
+ if locked {
135
+ passthrough_flags. push ( "--locked" . to_string ( ) ) ;
136
+ }
137
+ if offline {
138
+ passthrough_flags. push ( "--offline" . to_string ( ) ) ;
139
+ }
140
+ if frozen {
141
+ passthrough_flags. push ( "--frozen" . to_string ( ) ) ;
142
+ }
119
143
if let Some ( jobs) = jobs {
120
144
passthrough_flags. push ( format ! ( "--jobs={jobs}" ) ) ;
121
145
}
122
-
123
146
passthrough_flags
124
147
} ;
125
148
let features =
0 commit comments