(key: &str)
| 5735 | } |
| 5736 | |
| 5737 | fn cargo_metadata_value(key: &str) -> Result<String> { |
| 5738 | let text = fs::read_to_string("Cargo.toml").context("read Cargo.toml")?; |
| 5739 | let needle = format!("{key} = \""); |
| 5740 | let start = text |
| 5741 | .find(&needle) |
| 5742 | .ok_or_else(|| anyhow!("Cargo.toml metadata key '{key}' is missing"))? |
| 5743 | + needle.len(); |
| 5744 | let end = text[start..] |
| 5745 | .find('"') |
| 5746 | .ok_or_else(|| anyhow!("Cargo.toml metadata key '{key}' is unterminated"))?; |
| 5747 | Ok(text[start..start + end].to_owned()) |
| 5748 | } |
| 5749 | |
| 5750 | fn verify_file_sha256(path: &Path, expected: &str, field: &str) -> Result<()> { |
| 5751 | ensure_file(path)?; |
no test coverage detected