Replace `if ... { panic!() }` with `assert!()`.
diff --git a/build.rs b/build.rs
index bc492f9..dc2dbef 100644
--- a/build.rs
+++ b/build.rs
@@ -77,9 +77,10 @@
// in a location with a newline in it, or we have no way to pass
// rustc-link-search to cargo.
let out_dir = &std::env::var("OUT_DIR").expect("Unable to read OUT_DIR");
- if out_dir.contains('\n') {
- panic!("Build path contains a newline, which is unsupported");
- }
+ assert!(
+ !out_dir.contains('\n'),
+ "Build path contains a newline, which is unsupported"
+ );
let out_layout_path: PathBuf = [out_dir, "layout.ld"].iter().collect();
fs::copy(linker_file_name, out_layout_path).unwrap();
diff --git a/core/runtime/build.rs b/core/runtime/build.rs
index 9ab7b78..d0281b5 100644
--- a/core/runtime/build.rs
+++ b/core/runtime/build.rs
@@ -24,9 +24,7 @@
let platform_filename = format!("{}.ld", platform);
let platform_path: PathBuf = ["layouts", &platform_filename].iter().collect();
println!("cargo:rerun-if-changed={}", platform_path.display());
- if !platform_path.exists() {
- panic!("Unknown platform {}", platform);
- }
+ assert!(platform_path.exists(), "Unknown platform {}", platform);
let out_platform_path: PathBuf = [out_dir, "layout.ld"].iter().collect();
copy(&platform_path, out_platform_path).expect("Unable to copy platform layout into OUT_DIR");
@@ -43,9 +41,10 @@
// in a location with a newline in it, or we have no way to pass
// rustc-link-search to cargo.
let out_dir = &std::env::var("OUT_DIR").expect("Unable to read OUT_DIR");
- if out_dir.contains('\n') {
- panic!("Build path contains a newline, which is unsupported");
- }
+ assert!(
+ !out_dir.contains('\n'),
+ "Build path contains a newline, which is unsupported"
+ );
#[cfg(not(feature = "no_auto_layout"))]
auto_layout(out_dir);