Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Aug 30, 2024
1 parent b8b0fb8 commit 66b1fc5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions main/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,19 @@ pub fn extract_cargo_toml_version(cargo_toml_path: &PathBuf) -> Result<String> {
let cargo_toml_contents = fs::read_to_string(cargo_toml_path)
.context("expected to find a Cargo.toml file in project directory")?;

let cargo_tom: Value =
let cargo_toml: Value =
toml::from_str(&cargo_toml_contents).context("failed to parse Cargo.toml")?;

// Extract the channel from the toolchain section
let Some(pkg) = toolchain_toml.get("package") else {
let Some(pkg) = cargo_toml.get("package") else {
bail!("package section not found in Cargo.toml");
};

let Some(version) = pkg.get("version") else {
bail!("could not find version in project's Cargo.toml [package] section");
};
let Some(version) = version.as_str() else {
bail!("version in Cargo.toml's [package] section is not a string");
};
Ok(version)
Ok(version.to_string())
}

pub fn hash_files(source_file_patterns: Vec<String>, cfg: BuildConfig) -> Result<[u8; 32]> {
Expand Down

0 comments on commit 66b1fc5

Please sign in to comment.