Skip to content

Commit baeaa63

Browse files
committed
don't need to handle any flags explicitly
1 parent d63eb21 commit baeaa63

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

crates/cargo-gpu/src/toml.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl Toml {
8888
);
8989
std::env::set_current_dir(working_directory)?;
9090

91-
let parameters = construct_build_parameters_from_toml_table(toml_type, table)?;
91+
let parameters = construct_build_parameters_from_toml_table(toml_type, &table)?;
9292
log::debug!("build parameters: {parameters:#?}");
9393
if let Cli {
9494
command: Command::Build(mut build),
@@ -143,24 +143,15 @@ impl Toml {
143143
/// Construct the cli parameters to run a `cargo gpu build` command from a TOML table.
144144
fn construct_build_parameters_from_toml_table(
145145
toml_type: &str,
146-
mut table: toml::map::Map<String, toml::Value>,
146+
table: &toml::map::Map<String, toml::Value>,
147147
) -> Result<Vec<String>, anyhow::Error> {
148148
let build_table = table
149-
.get_mut("build")
149+
.get("build")
150150
.with_context(|| "toml is missing the 'build' table")?
151-
.as_table_mut()
151+
.as_table()
152152
.with_context(|| {
153153
format!("toml file's '{toml_type}.metadata.rust-gpu.build' property is not a table")
154154
})?;
155-
let auto_install_rust_toolchain = if build_table.contains_key("auto_install_rust_toolchain") {
156-
build_table
157-
.remove("auto_install_rust_toolchain")
158-
.context("unreachable")?
159-
.as_bool()
160-
.context("auto_install_rust_toolchain must be bool")?
161-
} else {
162-
false
163-
};
164155
let mut parameters: Vec<String> = build_table
165156
.into_iter()
166157
.map(|(key, val)| -> anyhow::Result<Vec<String>> {
@@ -191,8 +182,5 @@ fn construct_build_parameters_from_toml_table(
191182
.collect();
192183
parameters.insert(0, "cargo-gpu".to_owned());
193184
parameters.insert(1, "build".to_owned());
194-
if auto_install_rust_toolchain {
195-
parameters.push("--auto_install_rust_toolchain".to_owned());
196-
}
197185
Ok(parameters)
198186
}

0 commit comments

Comments
 (0)