about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-07-23 14:47:13 +0200
committerljedrz <ljedrz@gmail.com>2018-07-23 14:47:13 +0200
commitfe588d894fa392fdf787c18a959b342d38d0c71c (patch)
treebe50072cdfa499237686ad83b94c725d2d96500e /src/librustc_codegen_llvm/back
parent210d61f05c8c2f9e58f167eb28ab9d8bbef4968b (diff)
downloadrust-fe588d894fa392fdf787c18a959b342d38d0c71c.tar.gz
rust-fe588d894fa392fdf787c18a959b342d38d0c71c.zip
Replace a few expect+format combos with unwrap_or_else+panic
Diffstat (limited to 'src/librustc_codegen_llvm/back')
-rw-r--r--src/librustc_codegen_llvm/back/rpath.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/back/rpath.rs b/src/librustc_codegen_llvm/back/rpath.rs
index f46205cb590..e73073cfad0 100644
--- a/src/librustc_codegen_llvm/back/rpath.rs
+++ b/src/librustc_codegen_llvm/back/rpath.rs
@@ -114,8 +114,8 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String
     let mut output = cwd.join(&config.out_filename);
     output.pop();
     let output = fs::canonicalize(&output).unwrap_or(output);
-    let relative = path_relative_from(&lib, &output)
-        .expect(&format!("couldn't create relative path from {:?} to {:?}", output, lib));
+    let relative = path_relative_from(&lib, &output).unwrap_or_else(||
+        panic!("couldn't create relative path from {:?} to {:?}", output, lib));
     // FIXME (#9639): This needs to handle non-utf8 paths
     format!("{}/{}", prefix,
             relative.to_str().expect("non-utf8 component in path"))