about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/llvm
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-10-12 16:16:00 +0200
committerljedrz <ljedrz@gmail.com>2018-10-19 09:45:45 +0200
commitd28aed6dc45ffccc790469cb04f3f775ddb2283a (patch)
treec1a3c356ba1ffc8173746e03f0f630ae4032624f /src/librustc_codegen_llvm/llvm
parentcb5e1b93e300cf9772a24c6de27d9f21cdae3123 (diff)
downloadrust-d28aed6dc45ffccc790469cb04f3f775ddb2283a.tar.gz
rust-d28aed6dc45ffccc790469cb04f3f775ddb2283a.zip
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations
Diffstat (limited to 'src/librustc_codegen_llvm/llvm')
-rw-r--r--src/librustc_codegen_llvm/llvm/archive_ro.rs2
-rw-r--r--src/librustc_codegen_llvm/llvm/diagnostic.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/llvm/archive_ro.rs b/src/librustc_codegen_llvm/llvm/archive_ro.rs
index e0a9f31e508..2a77f256e3a 100644
--- a/src/librustc_codegen_llvm/llvm/archive_ro.rs
+++ b/src/librustc_codegen_llvm/llvm/archive_ro.rs
@@ -40,7 +40,7 @@ impl ArchiveRO {
         return unsafe {
             let s = path2cstr(dst);
             let ar = super::LLVMRustOpenArchive(s.as_ptr()).ok_or_else(|| {
-                super::last_error().unwrap_or("failed to open archive".to_owned())
+                super::last_error().unwrap_or_else(|| "failed to open archive".to_owned())
             })?;
             Ok(ArchiveRO { raw: ar })
         };
diff --git a/src/librustc_codegen_llvm/llvm/diagnostic.rs b/src/librustc_codegen_llvm/llvm/diagnostic.rs
index c41a5f74ae3..b080c51c83a 100644
--- a/src/librustc_codegen_llvm/llvm/diagnostic.rs
+++ b/src/librustc_codegen_llvm/llvm/diagnostic.rs
@@ -77,7 +77,7 @@ impl OptimizationDiagnostic<'ll> {
             ).ok()
         ).ok();
 
-        let mut filename = filename.unwrap_or(String::new());
+        let mut filename = filename.unwrap_or_default();
         if filename.is_empty() {
             filename.push_str("<unknown file>");
         }