Skip to content

Commit 13b3921

Browse files
committed
remove execution_root and output_base CLI args
1 parent 5cfeac9 commit 13b3921

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

tools/rust_analyzer/bin/discover_rust_project.rs

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -147,41 +147,16 @@ impl Config {
147147
pub fn parse() -> anyhow::Result<Self> {
148148
let ConfigParser {
149149
workspace,
150-
execution_root,
151-
output_base,
152150
bazel,
153151
bazelrc,
154152
rust_analyzer_argument,
155153
} = ConfigParser::parse();
156154

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-
172155
// 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)?;
179157

180158
let config = Config {
181-
workspace: info_map
182-
.remove("workspace")
183-
.expect("'workspace' must exist in bazel info")
184-
.into(),
159+
workspace,
185160
execution_root: info_map
186161
.remove("execution_root")
187162
.expect("'execution_root' must exist in bazel info")
@@ -203,15 +178,7 @@ impl Config {
203178
struct ConfigParser {
204179
/// The path to the Bazel workspace directory. If not specified, uses the result of `bazel info workspace`.
205180
#[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,
215182

216183
/// The path to a Bazel binary.
217184
#[clap(long, default_value = "bazel")]

0 commit comments

Comments
 (0)