Skip to content

Commit

Permalink
Add warning on failed match
Browse files Browse the repository at this point in the history
  • Loading branch information
c-git committed Jan 31, 2024
1 parent 3763626 commit 7241d02
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion setup_script/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,14 @@ fn do_replacement(path: PathBuf, replacements: Vec<&ReplacementPair>) -> anyhow:
let mut content = std::fs::read_to_string(&path)
.with_context(|| format!("failed to read contents for {path:?}"))?;
for replacement in replacements {
content = content.replace(&replacement.from, &replacement.to);
let new_content = content.replace(&replacement.from, &replacement.to);
if new_content == content {
eprintln!(
"Warning: Was not able to find {:?} for replacement in {path:?}",
replacement.from
);
}
content = new_content;
}
let mut file = std::fs::OpenOptions::new()
.write(true)
Expand Down

0 comments on commit 7241d02

Please sign in to comment.