]> git.nega.tv - josh/narcissus/commitdiff
shark: Enable RUST_BACKTRACE by default
authorJoshua Simmons <josh@nega.tv>
Fri, 5 Apr 2024 22:18:05 +0000 (00:18 +0200)
committerJoshua Simmons <josh@nega.tv>
Fri, 5 Apr 2024 22:18:05 +0000 (00:18 +0200)
In debug builds we always want to enable backtraces if they're not
explicitly disabled by the environment variable.

title/shark/src/main.rs

index 1bed1219a017b2ed3f7b3d2f80fcdcb534adcd9e..cbd63869e6d14fcad9643a219da5881de03c10a0 100644 (file)
@@ -25,6 +25,11 @@ const NUM_SHARKS: usize = 50;
 const GLYPH_CACHE_SIZE: usize = 1024;
 
 pub fn main() {
+    #[cfg(debug_assertions)]
+    if std::env::var("RUST_BACKTRACE").is_err() {
+        std::env::set_var("RUST_BACKTRACE", "1")
+    }
+
     let app = create_app();
     let main_window = app.create_window(&WindowDesc {
         title: "shark",