Use unwrap_or_else in build.rs

This commit is contained in:
Victor Song 2022-09-30 22:55:37 -04:00
parent cd715a6e00
commit af267ba638

View File

@ -41,7 +41,7 @@ fn main() -> io::Result<()> {
let path = &out.join("version_string.txt"); let path = &out.join("version_string.txt");
// Bland version text // Bland version text
let mut f = File::create(path).expect(&path.to_string_lossy()); let mut f = File::create(path).unwrap_or_else(|_| { panic!("{}", path.to_string_lossy().to_string()) });
writeln!(f, "{}", strip_codes(&ver))?; writeln!(f, "{}", strip_codes(&ver))?;
Ok(()) Ok(())