Przeglądaj źródła

Use `unwrap_or_else` in build.rs

Victor Song 3 lat temu
rodzic
commit
af267ba638
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      build.rs

+ 1 - 1
build.rs

@@ -41,7 +41,7 @@ fn main() -> io::Result<()> {
     let path = &out.join("version_string.txt");
 
     // 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))?;
 
     Ok(())