@@ -147,41 +147,16 @@ impl Config {
147
147
pub fn parse ( ) -> anyhow:: Result < Self > {
148
148
let ConfigParser {
149
149
workspace,
150
- execution_root,
151
- output_base,
152
150
bazel,
153
151
bazelrc,
154
152
rust_analyzer_argument,
155
153
} = ConfigParser :: parse ( ) ;
156
154
157
- // Implemented this way instead of a classic `if let` to satisfy the
158
- // borrow checker.
159
- // See: <https://github.com/rust-lang/rust/issues/54663>
160
- #[ allow( clippy:: unnecessary_unwrap) ]
161
- if workspace. is_some ( ) && execution_root. is_some ( ) && output_base. is_some ( ) {
162
- return Ok ( Config {
163
- workspace : workspace. unwrap ( ) ,
164
- execution_root : execution_root. unwrap ( ) ,
165
- output_base : output_base. unwrap ( ) ,
166
- bazel,
167
- bazelrc,
168
- rust_analyzer_argument,
169
- } ) ;
170
- }
171
-
172
155
// We need some info from `bazel info`. Fetch it now.
173
- let mut info_map = get_bazel_info (
174
- & bazel,
175
- workspace. as_deref ( ) ,
176
- output_base. as_deref ( ) ,
177
- bazelrc. as_deref ( ) ,
178
- ) ?;
156
+ let mut info_map = get_bazel_info ( & bazel, Some ( & workspace) , None , None ) ?;
179
157
180
158
let config = Config {
181
- workspace : info_map
182
- . remove ( "workspace" )
183
- . expect ( "'workspace' must exist in bazel info" )
184
- . into ( ) ,
159
+ workspace,
185
160
execution_root : info_map
186
161
. remove ( "execution_root" )
187
162
. expect ( "'execution_root' must exist in bazel info" )
@@ -203,15 +178,7 @@ impl Config {
203
178
struct ConfigParser {
204
179
/// The path to the Bazel workspace directory. If not specified, uses the result of `bazel info workspace`.
205
180
#[ clap( long, env = "BUILD_WORKSPACE_DIRECTORY" ) ]
206
- workspace : Option < Utf8PathBuf > ,
207
-
208
- /// The path to the Bazel execution root. If not specified, uses the result of `bazel info execution_root`.
209
- #[ clap( long) ]
210
- execution_root : Option < Utf8PathBuf > ,
211
-
212
- /// The path to the Bazel output user root. If not specified, uses the result of `bazel info output_base`.
213
- #[ clap( long, env = "OUTPUT_BASE" ) ]
214
- output_base : Option < Utf8PathBuf > ,
181
+ workspace : Utf8PathBuf ,
215
182
216
183
/// The path to a Bazel binary.
217
184
#[ clap( long, default_value = "bazel" ) ]
0 commit comments