Skip to content

Commit 0ee181e

Browse files
committed
refactor(embedded): Clarify functions limited role
1 parent a81650c commit 0ee181e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cargo/util/toml/embedded.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ pub(super) fn expand_manifest(
5454
}
5555
cargo_util::paths::write_if_changed(&hacked_path, hacked_source)?;
5656

57-
let manifest = expand_manifest_(&frontmatter, &hacked_path)
57+
let manifest = inject_bin_path(&frontmatter, &hacked_path)
5858
.with_context(|| format!("failed to parse manifest at `{}`", path.display()))?;
5959
let manifest = toml::to_string_pretty(&manifest)?;
6060
Ok(manifest)
6161
} else {
6262
let frontmatter = "";
63-
let manifest = expand_manifest_(frontmatter, path)
63+
let manifest = inject_bin_path(frontmatter, path)
6464
.with_context(|| format!("failed to parse manifest at `{}`", path.display()))?;
6565
let manifest = toml::to_string_pretty(&manifest)?;
6666
Ok(manifest)
6767
}
6868
}
6969

70-
fn expand_manifest_(manifest: &str, path: &std::path::Path) -> CargoResult<toml::Table> {
70+
/// HACK: Add a `[[bin]]` table to the `original_toml`
71+
fn inject_bin_path(manifest: &str, path: &std::path::Path) -> CargoResult<toml::Table> {
7172
let mut manifest: toml::Table = toml::from_str(&manifest)?;
7273

73-
// HACK: Using an absolute path while `hacked_path` is in use
7474
let bin_path = path.to_string_lossy().into_owned();
7575
let file_stem = path
7676
.file_stem()

0 commit comments

Comments
 (0)