Skip to content

Commit 5616cc8

Browse files
committed
Refactor normalized_build to accept slice instead of string
1 parent 0ff33ed commit 5616cc8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crates/cargo-util-schemas/src/manifest/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,12 @@ impl TomlPackage {
254254
self.authors.as_ref().map(|v| v.normalized()).transpose()
255255
}
256256

257-
pub fn normalized_build(&self) -> Result<Option<&String>, UnresolvedError> {
257+
pub fn normalized_build(&self) -> Result<Option<&[String]>, UnresolvedError> {
258258
let build = self.build.as_ref().ok_or(UnresolvedError)?;
259259
match build {
260260
TomlPackageBuild::Auto(false) => Ok(None),
261261
TomlPackageBuild::Auto(true) => Err(UnresolvedError),
262-
TomlPackageBuild::SingleScript(value) => Ok(Some(value)),
262+
TomlPackageBuild::SingleScript(value) => Ok(Some(std::slice::from_ref(value))),
263263
}
264264
}
265265

src/cargo/util/toml/targets.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ pub(super) fn to_targets(
105105
if metabuild.is_some() {
106106
anyhow::bail!("cannot specify both `metabuild` and `build`");
107107
}
108-
let custom_build = Path::new(custom_build);
108+
assert_eq!(custom_build.len(), 1);
109+
let custom_build = Path::new(&custom_build[0]);
109110
let name = format!(
110111
"build-script-{}",
111112
custom_build

0 commit comments

Comments
 (0)